asp.net mvc - How to extend ASP IdentityRole in EF DbFirst -


how can extend identityroles work extended aspnetroles table? in asp mvc 5, identity 2.2 looked here & here answers not db first ef

step 1: extended/added companyid & descrole (to make role unique company/tenant)

create table [dbo].[aspnetroles]            // extended role table     [id] [nvarchar](50) not null,     [name] [nvarchar](50) not null,     [description] [nvarchar](50) not null,  // extended     [companyid] [nvarchar](50) not null,    // extended company/tenant 

step 2: create new role issue, create role fails, , cannot find extended companyid/desc properties on identityrole (its dbfirst ef strategy)


 //create role class  public actionresult createrole(formcollection collection)  {    try {      var context = new applicationdbcontext();     // rolestore     // var newrole = new aspnetroles();     // ontext.roles.add(new applicationrole) { // not visible...     context.roles.add(new microsoft.aspnet.identity.entityframework.identityrole()        {             name = collection["rolename"],                            });     context.savechanges();     viewbag.message = "role created !";     ...   //extended role class  public class applicationrole : identityrole  {    public applicationrole() : base() { }    public applicationrole(string name) : base(name) { }    public string description { get; set; }    public string companyid { get; set; }  } 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -