0

I have a solution (C# MVC5 and multiple other class libraries). In trying to move the Identity models to my Domainclass library and all the EF related Identity stuff to my DataLayer I am running into some circular references.

I've moved my ApplicationDbContext class and the ApplicationUserManager to the DataLayer. In trying to set my EmailService in ApplicationUserManager, I cant as I already reference the DataLayer project from Services as most of the services need to reference DataLayer for data.

What is the most appropriate way to handle this situation?

dinotom
  • 4,990
  • 16
  • 71
  • 139
  • 3
    The best way to resolve this is to move the overlapping functionality in both to a different project so that they don't reference each other anymore. If your project structure requires a circular reference then it indicates that you probably need to move classes the inter-related classes back into the same project. – thinklarge Dec 23 '15 at 20:23
  • 1
    Just a thought: why not consider your `ApplicationUserManager` class to be a 'service' -- and move it to the same class library as `EmailService`? – David Tansey Dec 23 '15 at 20:24
  • @David Tansey...was thinking the same thing and am moving in that direction – dinotom Dec 23 '15 at 20:42
  • Well now that Ive moved everything I cant register a user...Getting this error now in my regsitercontroller The entity type ApplicationUser is not part of the model for the current context. – dinotom Dec 23 '15 at 21:14
  • Look at this post for a possible answer to your latest error: http://stackoverflow.com/questions/23893710/the-entity-type-applicationuser-is-not-part-of-the-model-for-the-current-context – David Tansey Dec 23 '15 at 22:32
  • Well my problem turned out to be I had switched to having ApplicationDbContext from DbContext instead of IdentityDbContext....All good now ty – dinotom Dec 24 '15 at 13:47

0 Answers0