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...
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...
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...
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...
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...
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...
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 ...
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...
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, ...
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..
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...
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?
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 { ...
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 ...
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...
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! :)
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...
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...
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...
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...