The ADO.NET Entity Framework is a set of Object-Relational-Mapping (ORM) tools for the .NET Framework, since version 3.5 SP1.
1
vote
0answers
7 views
EF Include method doesn.t result
I create Asp.Net Mvc4 application with Code First EF. I create my model, and now I want get relational info from Database. I write get method for this info as follow:
public ...
0
votes
0answers
10 views
Domain driven design: overriding virtual methods in Domain classes
My application is broken down into several assemblies.
The MyProject.Infrastructure assembly contains all of the Domain objects such as Person and Sale as well as interfaces repositories such as ...
0
votes
0answers
3 views
GetTableName<T> not found on ObjectContext
I tried to use the second answer to the DbSet table name question, the DbContext based version, but I get a compile error on:
return objectContext.GetTableName<T>();return ...
0
votes
0answers
6 views
Is it advisable to have all tables have a reference to the top level table?
We have the following data structure, expressed in classes, as we use the Entity Framework Code First approach:
Public Class TopLevel
Publc Overridable LevelOnes As ICollection(Of LevelOne)
End ...
1
vote
1answer
24 views
how to manage frequent and complex poco changes to database structure
In order to tackle the constant changes to a poco class that we have, we are serializing our poco into json string and then storing them into nvarchar column in our sql database.
However, we are ...
0
votes
0answers
4 views
dbupdateconcurrencyexception when deleting non existing items
i try to delete items from my database using EF 5, when items are present in db it works as expected, if the item to delete isn't on my DB i get the following exception :
"Store update, insert, or ...
0
votes
2answers
34 views
Lambda: using .Include() with linked table data in EF
I am trying to filter linked table data using lambda .Include() with the following:
var jobs = db.jobs.Include(d => d.docs)
.Where(d => d.docs.startdate >= date1 && d ...
0
votes
0answers
12 views
How to insert a record using Entity Framework with foreign key lookup in a single operation?
Let's say I want to insert a new car with its make:
public class Car {
public int Id {get;set;}
public string Name {get;set;}
public MakeId {get;set;}
}
public class Make{
public int Id ...
1
vote
1answer
12 views
Multiple DbContexts in a single project
I am working on a project using EF5 and am lost when it comes to adding a second DbContext to the project. I have created the DbContext but my migrations do not work. How do I make sure that my second ...
0
votes
0answers
16 views
Entity Framework 5 - Code First - EF ignoring Entity Properties
I have an entity that contains the following properties:
public string Comments { get; set; }
public string CommentsTruncated
{
get
{
return ...
0
votes
1answer
10 views
Mapping a nullable decimal with Entity Framework?
I have a nullable decimal field in my table and when I generate an edmx model, the nullable decimal field does not show up in the entity. Is there a way to solve this?
0
votes
1answer
17 views
Calling a stored procedure with nothing to return using Entity Framework
I understand this is the way we call a stored procedure using Entity Framework.
context.Database.SqlQuery<myEntityType>(
"mySpName @param1, @param2, @param3",
new SqlParameter("param1", ...
0
votes
1answer
12 views
Is database refactoring impossible in Entity Framework 5 Migrations?
Say I have an entity class A that uses a surrogate key for its PK and defines a uniqueness constraint that involves an FK into a different entity class B. All is well and good. However, somewhere down ...
1
vote
1answer
27 views
How to work around slow joining queries in Entity Framework
I have an MVC 4 project that is using Code First with Entity Framework 6 (backed by SQL Server 2008). I'm trying to optimize a particularly nasty query that looks something like:
var tops = ...
0
votes
3answers
28 views
Entity Framework SaveChanges When Adding
If all I'm doing is adding new items to the DB, will SaveChanges() ever return less than the number that was added?
For example, if I add 5 new items, could it return a value of 3 in some error ...