Hi,
What is difference between these two statements:
var result = from c in context.CustomerEntities
join p in context.ProjectEntities on c.Pk equals p.CustomerPk
where p.Entered > DateTime.Now.AddDays(-15)
select c;
and
var result = from c in context.CustomerEntities
join p in context.ProjectEntities on c.Pk equals p.Customer...
Hi there,
I am trying to insert a standard record into my db using linq2db, but i keep seeing examples to ADD method which i don't appear to have ... what i have currently is the following, as you can see i have my datacontext.... (no add method) ... the Reservation class is a separate class i created as a DTO - i presume this is correc...
Hi,
If I design my db layer so I can swap it between a linq-to-sql or nhibernate implementation, I have to code against an interface.
This means the return type between both linq and nhibernate have to be the same i.e. List etc.
Is the list type the same?
...
Hi,
I want to return a count of new users since a specific date.
Users table has: UserID, username, dateJoined.
SELECT COUNT(USERID)
FROM Users
where dateJoined > @date
How would this look in linq-to-sql?
Can you use the keyword COUNT?
...
I'm running the following query on my database, which generates a sql query I know returns 0 results and when run in sql management studio takes less than a second to return.
var query = (from item in db.Table
where item.Field == FieldValue // Field is not the primary key but is indexed
from other in item.Assoc...
Hi there,
is there a good way of of returning a 1 to many relationship from linq2sql, probably needs some explanation ! :-)
Basically i have a table that has invoices and another table that is invoice details..
I have my linq2sql classes that were automatically created using linq2sql designer ...
So to return the query where invoice ...
Hello Everyone,
I have an entity table that is mapped to stored procedures in order to do all of the CRUD operations. The retrieval procedures mapped to this table mirror the properties of the table as they should. This same entity table has a one-to-reference with a lookup table.
I need to be able to access that lookup tables proper...
Anyone have some good examples (newb worthy) of what bulk inserting should look like or a great way to explain it, utilizing the whole LINQ to SQL method?
I've got a DB with about 7 tables I'm trying to link some .net pages to and as much as I can qry most of these tables, I'm having a heck of a time inserting into them. One complex sc...
Hi,
I have the following classes (I've trimmed the code):
public class SqlWeightTrackerRepository : IWeightTrackerRepository
{
private Table<WeightTracker> m_weightTrackerTable;
//... constructor + other code here
public IQueryable<WeightTracker> WeightTracker
{
get { return m_weightTrackerTable; }
}
}
//...
Hello. The way I develop may not be correct, any advice welcome.
At the moment I have a WPF application that uses a SQL2008 database. I have a copy of the database on a laptop and on my home machine. My application is versioned using SVN and I am obviously able go from the work laptop to the home machine and update/commit as required to...
Hi,
I have an ASP.NET MVC application that uses LINQ2SQL as the database layer. I can save data back to the database no problem but I've came across a few issues when trying to save using a wizard-type scenario where data is collected over a few different forms but not saved to the database until the last form "Save" button is clicked....
The question is in the title.
...
Consider the following code block:
using (PlayersDataContext context = new PlayersDataContext())
{
Console.WriteLine(context.Players.Count()); // will output 'x'
context.Players.InsertOnSubmit(new Player {FirstName = "Vince", LastName = "Young"});
Console.WriteLine(context.Players.Count()); // will also output 'x'; but I'd l...
Hello
I'm using LINQ, but my database tables do not have an IDENTITY column (although they are using a surrogate Primary Key ID column)
Can this work?
To get the identity values for a table, there is a stored procedure called GetIDValueForOrangeTable(), which looks at a SystemValues table and increments the ID therein.
Is there any ...
I have a case where I have a linq2sql dbml with 2 table in it
let simplify this by:
Table1
id int not null
fkid int not null (to table2.id)
and
Table2
id int not null
v1 bit not null
in the generated dbml, fkid is not the type nullable and by default it's value is 0
but in table2, I don't have an id 0
when i'm trying to insert a...
I have a fairly complex Linq query:
var q = from eiods in LinqUtils.GetTable<EIOfficialDesignee>()
let eiodent = eiods.Entity
join tel in LinqUtils.GetTable<EntityTelephone>()
on new { EntityID = eiodent.ID, TelephoneType = EntityTelephone.TTelephone.Office } equals new { tel.EntityID, tel.TelephoneType }
...
How do you go about integration testing your database through your domain layer/model (repositories) that uses LINQ 2 SQL in the implementation and leave the DB as you found it? In other words, the ideal world of unit testing the DB, the integration test would leave the DB as it found it.
Are there tools out there that will handle this...
May I know whether Spring.Net has built in support for Linq2SQL? Someone on Spring.Net forum mentioned there is a bridge for NHibernate. However, I might not use NHibernate at all. I am looking for direct support for Linq2Sql.
If I am using TxScopeTransactionManager and apply attribute based transaction to a business method which contai...
I've read --while trying to figure this out-- that with temporary tables there's the notion of a session in SQL Server. However, I have not been able to find any documentation regarding what exactly constitutes as a SQL Server session.
With this information, I'd like to implement some basic logging functionality.
My problem is that I ...
I started out with this question, which I sort of answered there, and now I'm asking the more fundamental question here. I've simplified the query down to this:
var q = from ent in LinqUtils.GetTable<Entity>()
from tel in ent.Telephones.DefaultIfEmpty()
select new {
Name = ent.FormattedName,
Tel = te...