Deriving both ApplicationUser and another class from IdentityUser ASP.NET Core -


in application have applicationuser standard class in project models folder such that:

public class applicationuser : identityuser {  } 

in same folder have class person defined that:

public class person {     public string firstname { get; set; }     public string lastname { get; set; }     public char gendre { get; set; }     public string cityofbirth { get; set; }     public string provinceofbirth { get; set; }     public string fiscalcode { get; set; }     public datetime dateofbirth { get; set; }     public address address { get; set; }     public string additionainfos { get; set; } } 

i tried let person iherit identityuser.

public class person : identityuser {     public string firstname { get; set; }     public string lastname { get; set; }     public char gendre { get; set; }     public string cityofbirth { get; set; }     public string provinceofbirth { get; set; }     public string fiscalcode { get; set; }     public datetime dateofbirth { get; set; }     public address address { get; set; }     public string additionainfos { get; set; } } 

and tried launch command dotnet ef migrations add ...to updated dbcontext.

this results in following error message:

the entity type 'identityuserlogin<string>' requires primary key defined. 

in dbcontext class definition have added following lines of code:

protected override void onmodelcreating(modelbuilder modelbuilder)     {         base.onmodelcreating(modelbuilder);         modelbuilder.ignore<identityuserlogin<string>>();         modelbuilder.ignore<identityuserrole<string>>();         modelbuilder.ignore<identityuserclaim<string>>();         modelbuilder.ignore<identityusertoken<string>>();         modelbuilder.ignore<identityuser<string>>();         modelbuilder.ignore<applicationuser>();     } 

i still error, different 1 before. visual studio complains id-type mismatch. has found int , string types same database entry. error message is:

'criminal.id' , 'criminal.id' both mapped column 'id' in 'criminals' configured use different data types ('int' , 'nvarchar(max)'). 

in project have 2 other classes derive class person.

my class criminal derives person, want derive identityuser.

it seems ma visual studio trying generate id, , gets in trouble because member of criminal class:

public int id { get; set; } 

any idea how solve it?


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -