Top "Ef-core-2.1" questions

If you have questions regarding the 2.1 version of Entity Framework for .NET Core.

Seed entity with owned property

I am trying to seed an user entity in my database. The User entity has an owend property EmailPermissions. When …

c# entity-framework-core ef-core-2.1
Scaffold-DbContext for database views in EF Core 2.1 (Query Types)

EF Core 2.1 has new feature - Query Types. Some of the main usage scenarios for query types are: Serving as …

asp.net-core ef-core-2.1
Execute RAW SQL on DbContext in EF Core 2.1

I have researched this and always found examples like this: var blogs = context.Blogs .FromSql("SELECT * FROM dbo.Blogs") .ToList(); …

c# sql entity-framework ef-core-2.1
Entity Framework Core 2.1, rename table using code-first migrations without dropping and creating new table

I'm using netcoreapp 2.1 with EF Core 2.1 and updating my database with data migrations and have come into a problem with …

c# .net-core entity-framework-migrations ef-core-2.1
How to specify a composite primary key using EFCore Code First Migrations

I'm using Asp.Net Core 2.1, Mvc, c#, EF Core with Code First and Migrations. I'm trying to build a table …

asp.net-core entity-framework-migrations composite-primary-key asp.net-core-2.1 ef-core-2.1
EF Core 2.1: Self-referencing entity with one to many relationship generates additional column

I have the following entity: public class Level { public int LevelId { get; set; } public int? ParentLevelId { get; set; } public string …

c# entity-framework-core one-to-many ef-fluent-api ef-core-2.1
Getting "attempt was made to lazy-load navigation property on detached entity" despite eager fetch

I'm using Entity Framework Core 2.1.2 with lazy loading enabled and am performing a query using AsNoTracking. I'm using Include to …

ef-core-2.1
EF Core 3 x.Contains() in expression where x is ICollection

I've got the following data layer setup: public class Repository : IRepository { private readonly MyDbContext _dbContext; public List<Meter> …

entity-framework-core ef-core-2.1 ef-core-3.0
EFCore: Entities association error during a simple property update

I'd like to set one bool property in my controller and save it to the database. EF throws an error …

c# entity-framework entity-framework-core ef-core-2.1
How to use .Include() in Entity Framework and EF Core

Is it possible to use .Include() in a way which works in both Entity Framework 6 and EF Core? I currently …

c# entity-framework ef-core-2.0 ef-core-2.1