iprincipal - Why to create a custom principal interface when you want to create a Custom Principal in Asp.net MVC? -


recently seaerched how create custom principal , got answer there 1 thing not understand, found solution on stack overflow

using system; using system.collections.generic; using system.linq; using system.web; using system.security.principal; namespace workflow.authorize {     interface icustomprincipal : iprincipal     {         int id { get; set; }         string firstname { get; set; }         string lastname { get; set; }     }      public class customprincipal : icustomprincipal     {          public iidentity identity { get; private set; }         public bool isinrole(string role) {              if(this.roles.contains(role))              return true;              else                 return false;         }          public customprincipal(string email)         {             this.identity = new genericidentity(email);         }          public int id { get; set; }         public string firstname { get; set; }         public string lastname { get; set; }         public string roles { get; set; }     }      public class customprincipalserializemodel     {         public int id { get; set; }         public string firstname { get; set; }         public string lastname { get; set; }         public string roles { get; set; }     }  } 

but not understand why developer created icustomprincipal interface , force customprincipal inherit why not customprincipal class inherits directly iprincipal interface

for me if need force users override additional properties , methods have create custom interface.

the developer created custom interface , added new properties firstname property , lastname property force apply them.

look here , find property iprincipal interface has identity property , not enough you.

i hope helps understand why developers create custom interfaces.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -