EF Data First with ASP.NET Identity and MVC 5 -


i've created asp.net mvc 5 application using individual user accounts authentication , sql server 2012 express.

the template seems have worked. can create accounts, manage user account, etc. use ef create additional tables app use, i'm doing wrong since conflicting classes (like applicationdbcontext{}) being created.

basically, have default aspnet database table , want see in ef designer. there fields add aspnetusers table.

the way doing "add item" , choose "ef designer database".

what method including default aspnet* tables in ef designer without generating conflicting classes created initial asp.net template? i'm using vs 2015 community.

since using identity not use "add item" option make changes database.

to add new properties applicationuser model locate file identitymodels.cs. should see similar below.

public class applicationuser: identityuser {     // add new properties here     public datetime dateofbirth { get; set; } } 

this file put new tables/models.

public class applicationdbcontext: identitydbcontext<applicationuser> {     public applicationdbcontext()          : base("defaultconnection", throwifvlschema: false)     public static applicationdbcontext create()     {         return new applicationdbcontext();     }     // add new tables here     public dbset<newmodel> newmodels { get; set; } } 

after have made changes need use ef data migrations commit changes database.

to install migrations use package manager console , type enable-migrations

to add migration type add-migration [enter description]

to commit database type update-database


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -