zzz projects Entity Framework Core EF Core
Home Articles Knowledge Base Online Examples
  • Home
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework Core - Knowledge Base (KB)

77 results in tag: ef-core-2.1

EF Core Inheritance issue (HasDiscriminator)

This is parent abstract class : ...public enum RequestType { TaxiRequester, WomenTaxiRequester, LuxaryTaxiRequester, MotrCycleRequester, VanetRequester } public enum PaymentType { Cash = 0, Credit=1, Free=2 } public abstra...
c# ef-core-2.1 ef-migrations entity-framework entity-framework-core
asked by paradise_human

EF AsNoTracking Causes error. Expression of type 'System.DateTime' cannot be used for assignment to type 'System.Nullable`1[System.DateTime]'

Today I decided to upgrade an old web project of mine from Asp.net core 1.1 to 2.1 and all was going quite smoothly until I attempted to retrieve a list of LocalEvent's from the DB. I was using .AsNotracking as I didn't need to make any changes to the obj...
c# ef-core-2.1 entity-framework entity-framework-core
asked by Mark Perry

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 I run the command...dotnet ef migrations add Initial;...I get the error ...The seed entity for entity type 'User' cannot be added...
c# ef-core-2.1 entity-framework-core
asked by Mathieu VIALES

Unexpected behaviour with Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ForEachAsync<T>()

Here are the steps to reproduce. The below program copies 10,000 rows from one SQL table to another using .Net Core console app and EF Core. The program inserts records in 100 batches, and (this is important!) it creates a new instance of DbContext for ea...
c# ef-core-2.0 ef-core-2.1 entity-framework-core
asked by Andrew

Dynamic data seeding migration-generation in EF Core 2.1 depending on DbContext bool-flag with usage in OnModelCreating()

Current situation...Hello, I have a dotnet standard library in which I use ...EF Core 2.1.1... (code first approach) to access the persistence layer. To create migrations I use a separate dotnet core console application (in the same solution) that contain...
c# ef-code-first ef-core-2.1 entity-framework entity-framework-core
asked by ChW

Multiple Foreign Keys EF Core 2.1 code first generates only 1 in DB

I have the following model:...public class User : AuditedModel { public string Login { get; } public string PasswordHash { get; } public User(string login, string password, User creationUser) : base(creationUser) { Login = login; ...
.net-core-2.1 asp.net-core asp.net-core-2.1 ef-core-2.1 entity-framework-core
asked by Antonio Casagrande

Return Task<IReadOnlyCollection<T>> from EF Core query without await?

I like to be as specific as is possible with my types. When offering up a method encapsulating a query it's common to see ...List<T>... returned (or more specifically ...Task<List<T>>....) No wonder with EF Core's ....ToListAsync()... method. But that'...
c# ef-core-2.1 entity-framework-core
asked by Licht

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 Name { get; set; } public virtual Level Parent { get; set; } public virtual HashSet<Level> Chil...
c# ef-core-2.1 ef-fluent-api entity-framework-core one-to-many
asked by Davide De Santis

Reverse Engineer Fails EF Core Power Tools

System.MissingMethodException: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.EntityFrameworkCore.Design.ServiceCollectionExtensions.AddHandlebarsScaffolding(Microsoft.Extensions.DependencyInjection.IServiceCo...
.net-core asp.net-core-2.0 ef-core-2.0 ef-core-2.1 entity-framework-core
asked by Morteza Sefidi

How to create unique index case insensitive at entity framework core 2.1

I use npqsql 4+ and efcore 2.1+, how I can create unique invariant case insensetive constraint on field?...The following construction doesn't work:...modelBuilder.Entity<Company>().HasAlternateKey(city => city.Name.ToUpperInvariant());
.net-core ef-core-2.1 entity-framework entity-framework-core npgsql
asked by AuthorProxy

EF Core ICollection does not contain a definition for 'Include'

I have a head and a details model with navigation properties between them. I'd like to get head records with details included. This works fine but the detail records I got doesn't contain all properties I need so I tried to add Include()....EF Core says ....
c# ef-core-2.1 entity-framework entity-framework-core
asked by Perrier

EF Core Include() statement is null for IQueryable

Ok, so this might be a bit hard to explain without a ton of code to support it but I will try my best....Essentially I am doing a query (currently on ef core 2.1) with involves a 1 to many relationships. However, the "many" collection is null when it mate...
c# ef-core-2.1 entity-framework entity-framework-core
asked by tjackadams

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 about other properties that are not even modified. ...The association between entities 'User' and 'RequestDetail' with the key value 'System.InvalidOperat...
c# ef-core-2.1 entity-framework entity-framework-core
asked by Perrier

What are EF Core 2.1 changes in owned types?

Docs... last changed at 02/26/2018, but there is some breaking changes that I need to fix....I have ...MyProcessContext... type, used as owned for many entities:...public class RequestData { public Guid CorrelationId { get; set; } public DateTime ...
c# ef-core-2.1 entity-framework-core
asked by smg

ExecuteSqlCommand with interpolated string results in 'invalid input syntax' error

According to this ...docs... and ...this..., I should be able to pass an interpolated string to ...ExecuteSqlCommandAsync... like this:...public async Task DeleteEntries(DateTimeOffset loggedOn) { await myContext.Database.ExecuteSqlCommandAsync( ...
c# ef-core-2.1 entity-framework-core
asked by sixtstorm1

Override default indexes in AspNetCore.Identity tables

I'm developing a multi-tenant application in ...ASP.NET Core 2.1.... I'm utilizing ...AspNetCore.Identity.EntityFrameworkCore... framework for user management. I want to add a ...unique index... combining ...NormalizedName... with ...TenantId... in ...Rol...
asp.net asp.net-core-1.1 c# ef-core-2.1 entity-framework-core
asked by Aruna

modelBuilder.Configurations.AddFromAssembly in EF Core

In ...EntityFramework 6.x..., if we have lots of ...EntityConfiguration... classes then we can assign all of them in ...OnModelCreating(ModelBuilder modelBuilder)... as follows instead of one by one:...protected override void OnModelCreating(ModelBuilder ...
asp.net-core c# ef-core-2.1 entity-framework-core
asked by TanvirArjel

Getting the value of the MaxLength attribute of a column in EF Core

I want to have a max length property set in a text field in html. ...I have the following code in my razor code:...<td> <label asp-for="AspNetUser.FirstName" ></label> </td> <td> <input type="text" asp-for="AspNetUser.FirstName" a...
c# ef-core-2.0 ef-core-2.1 entity-framework-core
asked by Wallace B. McClure

How to include object properties in EntityFrameworkCore InMemory

I want to test the DbContext with EntityFramework.InMemory, but when I try to include all objects properties, they are null, and I really don't know why....I have a UnitOfWorkLocator that is responsible to create and return the same UnitOfWork....public s...
.net-core .net-core-2.1 ef-core-2.1 entity-framework entity-framework-core
asked by Eduard Stefanescu

ef core - how to make multiple variations of a class map to the same table

I have 5 satellite assemblies with their own db contexts. I created a 6th the assembly just for code first migration. The idea was to add the satellite assemblies as references then create migration for all models. The quirk with this setup is that some o...
c# ef-code-first ef-core-2.1 entity-framework-core
asked by herme 0

Page 1 of 4
  • 1
  • 2
  • 3
  • 4
  • ยป

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!