Linked Questions

202 votes
7 answers
268k views

Ok, I have tri-leveled entities with the following hierarchy: Course -> Module -> Chapter Here was the original EF LINQ statement: Course course = db.Courses .Include(i => i....
AnimaSola's user avatar
  • 7,936
87 votes
5 answers
57k views

Is there a way to decorate your POCO classes to automatically eager-load child entities without having to use Include() every time you load them? Say I have a Class Car, with Complex-typed ...
Nathan Geffers's user avatar
51 votes
6 answers
71k views

I'm trying to get data from a LocalDb into my MVC Controller. I tried this: UsersContext db = new UsersContext(); var users = db.UserProfiles.Where(u => u.UserId == WebSecurity.CurrentUserId) ...
JazzMaster's user avatar
67 votes
2 answers
34k views

I want to get multiple nested levels of child tables in Entity Framework Core using eager loading. I don't think lazy loading is implemented yet. I found an answer for EF6. var company = context....
zoaz's user avatar
  • 2,109
46 votes
3 answers
74k views

I'm new to using LINQ to Entities (or Entity Framework whatever they're calling it) and I'm writing a lot of code like this: var item = (from InventoryItem item in db.Inventory where item....
JC Grubbs's user avatar
  • 40.5k
42 votes
1 answer
47k views

I'm transfering my .NET Framework (EF6) code to ASP.NET Core (EF Core), and I stumbled upon this issue. Here is some example code: In EF6 I use Include() and Select() for eager-loading: return ...
nikovn's user avatar
  • 2,018
2 votes
1 answer
5k views

Application Version: Asp Net Core 1.1 EF: Microsoft.EntityFrameworkCore (1.1.1) Line: _dbContext.MyTable1.Include(c => c.MyIntermediateTable).ThenInclude(k => k.Select(x => x.MyTable2)).ToList(); ...
Mario Guadagnin's user avatar
0 votes
2 answers
3k views

The above is my database .I have for tables Contact,Countries,States,Cities.The Country in contact table is foreign key to the Id in countries table. And I am using entity framework to get the data.I ...
Bharat Bhushan's user avatar
0 votes
1 answer
4k views

I have been searching the NET and SO for some answers - I am pretty much a noob to Entity framework .. so I do have some confusion on related entities .. I am using C# , Winforms, Linq , EF6^ (...
Ken's user avatar
  • 2,908
3 votes
2 answers
2k views

MY Model M:M relationship Reference to https://www.entityframeworktutorial.net/efcore/configure-many-to-many-relationship-in-ef-core.aspx Models public class Post { [Key] public int Id { get; ...
ZCoder's user avatar
  • 2,339
4 votes
1 answer
1k views

My data model has a lot of nested entities and I would like to eagerly load the whole object tree ... except for a view entities that will be explicitly loaded on demand. Using include paths I have ...
Stefan's user avatar
  • 12.8k
1 vote
2 answers
1k views

Here's my problem: I have a class that have 2 list properties of the same class type (but with some different restriction as on how to be filled), let's say: public class Team { [Key] ...
Marcelo Myara's user avatar
2 votes
0 answers
2k views

I'm using Entity Framework to save my data to a database. Now I have a class: public class User { public int Id { get; set; } public virtual ICollection<User> Friends { get; set; } ...
Florian's user avatar
  • 1,897
1 vote
2 answers
732 views

I'm trying to figure out how can i retrieve roles with Any and check if user exists on the same query and return as SingleOrDefault() but doesn't seem to work. private User Authenticate(...
Jackal's user avatar
  • 3,531
0 votes
1 answer
1k views

I'm trying to use ASP.NET Core 2.2.0 with Entity Framework Core and I'm facing a bit of troubles. I want to display a list of pictures of different celestial objects I took (nebula, galaxies, etc...). ...
F.Carette's user avatar
  • 103

15 30 50 per page