MVC Entity Framework with Identity Best Practise

Hi All

I'm after some help, advice and ideas for 'best practise' when using the Identity plugin for Entity Framework and code first.

I would like to keep my Entity, Repository and MVC Site in seperate solutions. But an unsure how to link them in the most efficient way. Also, on this project I m looking at integrating the Identity plugin. Now should I install and run this from the mvc site project? or the db project? or both?

Basically, I want to be able to build the t4 pages with CRUD options quickly using the scaffolding built in. However, all the videos and tutorials seem to do this with the entity framework in the same solution.

Any advice and help on this is appreciated.

Thanks in advance,

Matt.
flynnyAsked:
Who is Participating?
 
Bob LearnedCommented:
I have used Identity in only one project, but it is something that I find interesting to learn.  The project that I created was an MVC 5 web site, with OWIN and Entity Framework.  The system allowed for people to use social logins, like Facebook and Twitter.

I found a nice explanation here:

Code! MVC 5 App with Facebook, Twitter, LinkedIn and Google OAuth2 Sign-on (C#)
http://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on

I kept all the parts in the same assembly, as it is easier to maintain, in  my opinion.  Maintaining shared assemblies across multiple projects creates dependencies that can "muddy the waters".

I will continue to find a "better practice" reference.
0
 
Bob LearnedCommented:
I haven't seen anything about a "better practice" with Identity and Entity Framework.

How much have you done with setting this up?  What is the reason that you want separate assemblies?
0
 
flynnyAuthor Commented:
Hi Bob,

I want to keep the db project seperate so multiple projects can conected through the sam entity.

Regarding using Identity, I haven't really used it before and normally scaffold up a user table, etc, so this appears in the entity project itself. Also I like to keep my projects modular as far as I can.

From looking at the MVA videos tutorials, etc. It seems that the easiest way to go about is to do the following;

1. Create a new project with authentication
2. Set the default connection to be that of the database
3. Run the project and simply create a new use by clicking the register button. This seems to then create the tables in question.

I could then just reverse engineer the entity classes from the existing entity project. So I suppose then the Identt reference would be in the MVC site project? However as there are models etc it feels like these should be extracted to a seperate DAL project maybe?

Any advice on how you implement is welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.