MVC5 Store and manager classes
asp.net, asp.net-mvc, asp.net-mvc-5, c#, design-patterns
Solution
This is how I see it:
- The Manager class is a concrete instance used to manage users and apply domain logic. Typically finding users, add passwords and claim management.
- The store is what the user manager uses for CRUD implementation.
- The UserManager is passed to the constructor so that it can be instantiated and used within the AccountController. You can create another constructor taking it as an arguement for IOC.
- I think of the Manager as being like a service layer or fat controller (i.e. contains business logic for managing Users) and the Store as being a repository that deals with CRUD.
Problem
I know the MVC pattern which stands for Model View Controller. But Where do Store and Manager class files come from? I started My project with MongoDB and i implemented the MongoDB.AspNet.Identity. Which is an extension of the Microsoft.AspNet.Indentity with the EF. But when looking at the AccountController that is provided by this package they are using the following code. ``` public AccountController() : this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>("DefaultConnection"))) { } ``` Now my questions: - What is the prupose of the Manager class - What is the purpose of the Store class? - And why is the UserManager passed to the Controller of MVC? - And to what pattern belong the Manager and Store classes?