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...
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...
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...
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...
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;
...
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'...
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...
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());
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 ....
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...
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...
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 ...
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(
...
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...
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 ...
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...
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...
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...