I'm beginner in ASP.NET MVC5.
My project solution has the structure as described in ASP.NET MVC5 Pro:
Solution
-Project.Domain --- C# Class Library
-Project.WebUI --- Empty ASP.Net MVC Project Template
-Project.UnitTests
And I want to use ASP Identity 2.0 in it.
In Project.Domain I have Concrete (contexts, their initializers) and Entities (data models) foldiers.
I installed Identity 2.0 Samples as described here.
I split the IdentityModels.cs file into ApplicationDbContext.cs and ApplicationUser.cs, and put them in Concrete and Entities foldiers respectively.
Also in Concrete foldier I have EFDbContext.cs - separate from ApplicationDbContext context (they use the same database connection).
I wanted to store AppicationDbInitializer class (from Project.WebUI\App_Start\IdentityConfig.cs) in Project.Domain since ApplicationDbContext contains static constructor which set ApplicationDbInitializer, but then it turned out that Project.Domain and Project.WebUI have cyclic dependence, so I decided not move it and set database initializer in Global.asax.cs from Project.WebUI.
Then problems began. For some reasons method ApplicationDbInitializer.Seed isn't working and role "Admin" isn't created.
Then I decided to try enable migrations. I enabled migrations in Project.Domain (as described here) and for implementing Seed I need access to classes from IdentityConfig.cs (ApplicationUserManager and ApplicationRoleManager) from Project.WebUI. Unfortunately, It again will create cyclic dependence.
My question is what to do:
How properly to divide solution on projects and locate Identity 2.0 files?
And why Seed method from ApplicationDbInitilizer not working?