Archivi categoria: Entity Framework

Optimize Entity Framework performance

This wouldn’t be a complete article on how to improve EF performance but only a little reminder. Every time you have performance problem on updating or adding entity these properties will help you. You can find a lot of articles … Continua a leggere

Pubblicato in .Net, Entity Framework | Lascia un commento

Serializing Entity Framework classes with JSON (Web API) without relationship

How many times have you ever tried to serialize an object of a type generated by EntityFramework. As you know with Entity Framework the relationship between to tables are made using virtual IEnumerable. As just you try to access to … Continua a leggere

Pubblicato in .Net, Asp.Net, c#, Entity Framework, MVC | Contrassegnato , | Lascia un commento

The entity or complex type cannnot be constructed in a LINQ to Entities query

In some cases it is necessary read form a table and return a different type. A typical cases is if you read from a base table but you wanna return the view class and not the table class mapped by … Continua a leggere

Pubblicato in .Net, c#, Entity Framework | Contrassegnato | Lascia un commento

Entity Framework left outer join

Many times I talked about Entity Framework join by linq. Today I show how to do LEFT OUTER JOIN or LEFT JOIN. Notice the end of line “join sve”, you’ll notice “into sveList” Then I call DefaultIfEmpty on this var … Continua a leggere

Pubblicato in c#, Entity Framework, SQL | Contrassegnato , , , | Lascia un commento

Entity Framework Many to Many join

If you use Entity Framework 6 (EF) design first to create the domain classes if you have a relationship many to many without any extra field inside the join table, EF will avoid to create the join table model. On … Continua a leggere

Pubblicato in c#, Entity Framework, SQL | Contrassegnato , , , , | Lascia un commento

Join in Linq, Join in Entity Framework

There are two way to do a join in a query with linq. Using Join Using the relationship property I tried both ways and the SQL generated by Entity Framework (EF6) is the same, so choose what you prefer.

Pubblicato in c#, Entity Framework | Contrassegnato , , | Lascia un commento

Entity Framework Update Single property and Validation Errors

As has already been said about how to update only one property of our model in EF. Here I wanna go more deep in this argument: 1) attach before, modify the property after 2) attach before, modify the property after … Continua a leggere

Pubblicato in Entity Framework | Contrassegnato , , , , | Lascia un commento