Removing an AspNetUserLogins Table from an ASP.NET Identifier

Since I will not use other login providers, I do not need a table AspNetUserLogins. Is there any way to remove it?

I tried this:

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    modelBuilder.Ignore<IdentityUserLogin<string>>();
}

but I just get an error Invalid object name 'dbo.UserLogin'whenever I call UserManager.FindAsync(username, password).

Thanks in advance.

+4
source share
2 answers

It looks like you are still using the built-in Microsoft.AspNet.Identity.EntityFramework.UserStore, which expects these objects to be there. The default EF implementation was not configured in this way.

UserManager , , IUserStore ( IUserLoginStore.

+3

, , , UserStore , , , "" AspNetUserLogins.

SQL Server:

create view AspNetUserLogins
as
select '' as LoginProvider, '' as ProviderKey, '' as UserId;

Oracle :

create view AspNetUserLogins
as
select '' as LoginProvider, '' as ProviderKey, '' as UserId
from dual;


Identity, . - , , imo, , . - , , UserStore - , .

0

Source: https://habr.com/ru/post/1529079/


All Articles