简体   繁体   中英

Application User in class library ASP.net MVC

I create a new web project in Visual Studio 2013 with MVC and Individual User Account Authentication

I Have a Entity Framework Code-First database in a Class Library, How is the best way to put the entity class and ApplicationUser in the same place?

Put the Entity Framework Class in the Web Project

OR

Put the ApplicationUser into Class Library (if that's the way, how to Do it?)

As an ASP.NET MVC developer who was wondering the same thing at the beginning of my MVC development, let me share with you how I handle this:

I have a separate class library called DAL (Data Access Layer). Of course add reference to Entity Framework in DAL. Then I delete the ApplicationUser class from the Web app and create it into the DAL project and inherit from IdentityUser class. Then in MVC app I go and change the using statements to match the ones from DAL where ApplicationUser is being used.

Hope I helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM