Top "Ef-core-2.0" questions

Use this tag if you have questions regarding the 2.0 version of Entity Framework for .NET Core.

FirstOrDefaultAsync() & SingleOrDefaultAsync() vs FindAsync() EFCore

We have 3 different approaches to get single items from EFCore they are FirstOrDefaultAsync(), SingleOrDefaultAsync() (including its versions with not default …

c# linq ef-core-2.0
Moving from EF6 to EF Core 2.0

I just started moving my MVC5 project with EF6x to MVC Core and EF Core but have a big …

c# entity-framework-core ef-fluent-api ef-core-2.0
EF Core 2.0 scaffold-dbcontext Find ConnectionString in another project

I am using the EF Core 2.0 CLI command scaffold-dbcontext to reverse engineer poco classes from an existing DB (database first). …

entity-framework .net-core ef-core-2.0
EFCore nullable relationship setting onDelete: ReferentialAction.Restrict

I'm running efcore 2.0.1. I have a model: public class BigAwesomeDinosaurWithTeeth { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } public …

entity-framework ef-code-first entity-framework-core ef-core-2.0
Rename a foreign key in Entity Framework Core without dropping data

I have two model classes: public class Survey { public int SurveyId { get; set; } public string Name { get; set; } } public class …

c# sql-server entity-framework entity-framework-core ef-core-2.0
may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints

Entity Framework Core Throwing error while doing update-database Error:- Introducing FOREIGN KEY constraint 'FK_UserRoleRelationship_UserRoels_ParentUserRoleId' on table …

entity-framework asp.net-core migration entity-framework-core ef-core-2.0
EF Core DbUpdateConcurrencyException does not work as expected

I have the following code that I am trying to update ClientAccount using ef core but they Concurrency Check fails: …

c# .net ef-code-first entity-framework-core ef-core-2.0
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