Hi,
how can i use IdentityDbContext in Entity Developer? Any tips?
IdentityDbContext
Re: IdentityDbContext
The new extended model property Base Context Type is added in Entity Developer v6.10.1165 for specifying a parent class for the generated context in EF Core Model.
Re: IdentityDbContext
It works but...
- when context base class is IdentityDbContext its missing "using Microsoft.AspNetCore.Identity.EntityFrameworkCore;" - it can be fixed by setting base to class to: Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext
- protected override void OnModelCreating(ModelBuilder modelBuilder) need "base.OnModelCreating(modelBuilder);" which is removed everytime when code is generated
- other base classes like "IdentityUser" or "IdentityRole" need also "using Microsoft.AspNetCore.Identity;" or full namespace.
Summary:
- the real problem is "base.OnModelCreating(modelBuilder);"
- when context base class is IdentityDbContext its missing "using Microsoft.AspNetCore.Identity.EntityFrameworkCore;" - it can be fixed by setting base to class to: Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext
- protected override void OnModelCreating(ModelBuilder modelBuilder) need "base.OnModelCreating(modelBuilder);" which is removed everytime when code is generated
- other base classes like "IdentityUser" or "IdentityRole" need also "using Microsoft.AspNetCore.Identity;" or full namespace.
Summary:
- the real problem is "base.OnModelCreating(modelBuilder);"
Re: IdentityDbContext
We are going to update the predefined template to generate "base.OnModelCreating(modelBuilder);" if the Base Context Type model property is set. We will notify you when a new public build of Entity Developer is available for download.
Re: IdentityDbContext
Code generation is improved: OnModelCreating(modelBuilder) of the base class is invoked now if the Base Context Type property of EF Core Model is initialized. Refer to viewtopic.php?f=32&t=44483.