Questions tagged [entity-framework-4.2]
10 questions
9
votes
1 answer
Difference between DbSet.Remove and DbContext.Entry(entity).State = EntityState.Deleted
Consider the following entity model:
public class Agreement : Entity
{
public int AgreementId { get; set; }
public virtual ICollection Participants { get; set; }
}
public class Establishment : Entity
{
public int…

danludwig
- 46,965
- 25
- 159
- 237
3
votes
0 answers
Do 2 queries need to be submitted to the database to get total count and paged section using EF / Linq to Entities?
Possible Duplicate:
Better way to query a page of data and get total count in entity framework 4.1?
When implementing pagination using EF / LINQ to entities, I am familiar with using Skip() and Take() to decide which paginated section to display.…

danludwig
- 46,965
- 25
- 159
- 237
2
votes
1 answer
Entity Framework generates a second left join in a one-to-one (optional/required) relationship
I have the following models in EF Code First:
public class A
{
public int Id { get; set; }
public virtual B { get; set; }
}
public class B
{
public int Id { get; set; }
public virtual A { get; set; }
}
I have defined the…

Dismissile
- 32,564
- 38
- 174
- 263
2
votes
1 answer
EF Query to Get Union of All Child Collections
Assuming I have an Entity Framework 4.2 class like this:
class Company
{
public int ID { get; set; }
public ICollection Employees { get; set; }
}
And I have collection like this:
public ICollection Companies { get; set;…

Jonathan Wood
- 65,341
- 71
- 269
- 466
2
votes
1 answer
Code First and Cascade on Delete Errors with Simple Model
I have a simple model to keep track of locker rentals as a way to learn EF Code First and DDD principles. The model has these requirements:
There may be many organizations (i.e. schools, colleges, etc.).
Each organization can have many lockers and…

Alex Jorgenson
- 891
- 1
- 13
- 17
1
vote
3 answers
Third-party applications asks for old assembly
Have a serious problem: need to install a third-party web application. After deploying to my local machine getting the exception:
Could not load file or assembly 'System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'…

Magister Crazy
- 26
- 2
1
vote
1 answer
Batching Stored Procedure Commands in EF 4.2
I've got a call to a stored procedure, that is basically an INSERT stored procedure. It inserts into Table A, then into Table B with the identity from Table A.
Now, i need to call this stored procedure N amount of times from my application code.
Is…

RPM1984
- 72,246
- 58
- 225
- 350
1
vote
1 answer
Calling database upon ToList() method call
From my repository I return different List using ToList() method.
The problem is when I run some more LINQ on this returned result (i.e. of type List) it generates a database call for this too. Apparently this second linq calll is pure LINQ to…
user1379354
0
votes
0 answers
Web Api Returning Json - [System.NotSupportedException] Specified method is not supported. (Sybase Ase)
I'm using Web api with Entity Framework 4.2 and the Sybase Ase connector.
This was working without issues returning JSon, until I tried to add a new table.
return db.car
.Include("tires")
.Include("tires.hub_caps")
…

trees_are_great
- 3,881
- 3
- 31
- 62
0
votes
0 answers
How to have an entity inherit from another base entity and map to db using TPC with EF 4.2?
Say I have an entity model aggregate for Activity, like so:
public class Activity : Entity
{
public int PersonId { get; set; }
public virtual Person Person { get; set; }
public int Number { get; set; }
public string Title { get; set;…

danludwig
- 46,965
- 25
- 159
- 237