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

Entity Framework Core - Knowledge Base (KB)

111 results for: in tag: ef-core-2.0

Upgrade to EF Core 2.0: System.InvalidOperationException: The property 'Id' cannot be configured as 'ValueGeneratedOnUpdate'

I am upgrading an Asp.Net Core 1.1 application to Asp.Net Core 2.0....I am getting a common error in all my Entity Framework 2.0 queries:...System.InvalidOperationException: The property 'Id' cannot be configured as 'ValueGeneratedOnUpdate' or 'ValueGene...
asp.net-core c# ef-core-2.0 entity-framework-core
asked by Miguel Moura

EF Core 2.0 TransactionScope Error

I am trying to use TransactionScope in my SELECT query in EntityFramework Core 2.0. However I am getting this error : ..."Enlisting in Ambient transactions is not supported."...The idea is to implement "NO LOCK" option (I know it's not a good idea to have...
c# ef-core-2.0 entity-framework entity-framework-core transactionscope
asked by Alan B

How to run `dotnet ef` commands to target a specific appsettings.[environment].json in EF Core 2.0

The docs mention that there is no support in 2.0 for passing in custom environment variable, but EF core 1.0 supported the --environment argument. I kind of feel that this feature should still be supported in EF Core 2.0. ...Currently, I am deploying mult...
asp.net-core asp.net-core-2.0 ef-core-2.0 entity-framework-core
asked by Patrick Magee

Group properties into classes and map them to the same table as root class in Entity Framework Core

I have an entity with hundreds of properties. While it is good in database, in classes it is inconvenient. The question is, how can I group some properties of the class into other classes so it would be more convenient in programming, while keeping only o...
asp.net-core c# ef-core-2.0 entity-framework entity-framework-core
asked by SirGordon

ASP.NET Core multiple dbcontext cannot add migration

I have 2 DbContexts:...services.AddDbContext<ConfigDbContext>(options => options.UseSqlServer(Configuration["Data:ConfigSQLServer:ConnectionString"].ToString(), t => t.MigrationsAssembly("App.Web"))); services.AddDbContext<AppDbContext>(options => option...
asp.net-core asp.net-core-2.0 c# ef-core-2.0 entity-framework-core
asked by user2818430

Owned type property not persisting for a modified entity in EF Core

I'm trying to achieve something in EF Core that worked very well for me in EF 6....I'm serializing the contents of a ...List<T>... property as a Json string in the DB. ...<T>... can be pretty much anything, since Json.Net takes care of serializing whateve...
c# ef-core-2.0 entity-framework entity-framework-core
asked by Matt Jenkins

Prevent updates to navigation properties in EF-core

Please how can we prevent EF.core from trying to insert/update foreign-key tables when we create a new primary entity?...This Exception is thrown:...SqlException: Cannot insert explicit value for identity column in table 'clients' when IDENTITY_INSERT is ...
ef-core-2.0 entity-framework-core
asked by Charles Okwuagwu

Ordering By Child Entity EF Core

I have an extension method to sort my entities, and in some cases i need to sort on a property of a child collection... public static IQueryable<Payment> SetSort(this IQueryable<Payment> payments, string sortProperty, string direction) if (s...
.net c# ef-core-2.0 entity-framework entity-framework-core
asked by MrBliz

Best approach for entityframework core multi tenancy

We develop a bigger SaaS application based on ASP.NET Core and EFCore. We separate tenants by database, means that we have one database for each tenant....The database is migrated on any incoming request by a client by a custom middleware. This required, ...
asp.net-core ef-core-2.0 entity-framework-core
asked by Valentin B.

Use IEntityTypeConfiguration with a base entity

In EF Core 2.0, we have the ability to derive from ...IEntityTypeConfiguration... for cleaner Fluent API mappings (...source...)....How can I extend this pattern to utilize a base entity? In the example below, how can I have a ...BaseEntityConfiguration..
asp.net-core c# ef-core-2.0 ef-fluent-api entity-framework-core
asked by Collin M. Barrett

How to get appsettings from project root to IDesignTimeDbContextFactory implementation in ASP.NET Core 2.0 and EF Core 2.0

I am building an application in ASP.NET Core 2.0 and I am having problems with EntityFramework Migrations....I have my DbContext in a separate project (...SolutionName...\...ProjectNamePrefix....Data) and therefore I created an implementation for the IDes...
asp.net asp.net-core-2.0 ef-core-2.0 entity-framework entity-framework-core
asked by V. Samma

Check if applied migrations match the DbContext?

I want to create a unit test to ensure no developer will commit model changes without the corresponding migration. ...How do I test that the database matches the DbContext?
.net-core ef-core-2.0 entity-framework-core
asked by Alexander Herold

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:... public class ClientAccount { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { ...
.net c# ef-code-first ef-core-2.0 entity-framework-core
asked by pantonis

EF Core Migrations manual edits possible?

I am using EF Core 2.0 in my sample project with some value object configurations. I modify the code and generate migrations via CLI command line. In the last migration rather than adding a new database table as it should, it is trying to rename existing ...
ef-core-2.0 ef-migrations entity-framework entity-framework-core
asked by user3141326

Apply all IEntityTypeConfiguration derived classes using EF Core 2.0

Does anyone know of a way or have an implementation to apply ALL classes that derive from ...IEntityTypeConfiguration<>... to the ...DbContext... at runtime?...There doesn't seem to be anything built in and loading each one manually via:...protected overr...
c# entity-framework entity-framework-core
asked by Jay

Entity Framework Core pros and cons of DBSet<MappingTable>

What are pros and cons for mapping table DbSet in the DbContext in EF Core? Why should we do it like this or why not?...public DbSet<CategoryBooks> CategoryBooks { get; set; } ...Thanks in advance! :)
ef-core-2.0 entity-framework-core
asked by user7298209

Entity Framework Core seed update

I am new to Ef Core. Trying to seed data while migration update....He is how i did it...First created an initializer class:...using AcademicNet.Data.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Syst...
c# ef-core-2.0 entity-framework entity-framework-core
asked by Nick B

EF Core, INotifyPropertyChanged

I am implementing the INotifyPropertyChanged Interface on my EF POCOs. I am using newtonsoft to serialize my models to JSON. Currently my object is using [JsonProperty] attributes to tell newtonsoft what to serialize. When I implement this interface I wil...
c# ef-core-2.0 entity-framework-core
asked by Cody Wright

Per-operation collation in Entity Framework Core

I have a database which uses the default C collation. This database is for an app that will be used by both English and French users, so I can't set a specific collation at design-time on the database itself, but I must do it on a per-operation basis, bas...
ef-core-2.0 entity-framework entity-framework-core postgresql
asked by sixtstorm1

EF Core 2.0 connection string in Azure Functions .NET Core

I'm using EF core 2.0 in Azure Functions using .net core. I'm trying to read db ConnectionString from local.settings.json, which is defined:...{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", "AzureWebJo...
azure azure-functions c# ef-core-2.0 entity-framework-core
asked by Boris Lipschitz

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

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