The structure of my solution is this:
I'm using ÀSP.NET MVC 4
and the DAL
project is using Entity Framework 5
and Code First
workflow. The MVC
template has the <profile defaultProvider="DefaultProfileProvider">
set and I need to implement SingleMemebershipProvider
(not creating new template that is including it by default). I found several tutorials on this topic but for my scenario I wonder where is the place of the SingleMemebrshipProvider
.
I want to use the existing database, and also I've read that it's just fine to map whichever table to be used by the SingleMemebrshipProvider
(even though I plan on creating entity exactly for the purpose to deal with SingleMemebrshipProvider
) but from this point of view it seems logically to include SingleMemebrshipProvider
in my DAL
project.
However it's services will be used from the NVC
project and also I wonder if I won't break any conceptions if I try to set the SingleMemebrshipProvider
in another project. The default template that provides SingleMemebrshipProvider
has Controller - AccountController
, Filter- InitializeSingleMemebrshipProviderAttributes
, Models- AccountModels
and maybe the MVC
expects to find those classes.
However, I am not sure which approach to take. In a solution structured this way where is the place of the SingleMemebrshipProvider
? (If possible explain why too).
It belongs to the ASP.NET MVC project if you ask me. I usually add a new folder to the web project called "Security". I put stuff, like the Membership and Role provider implementations inside this folder.
You should ask yourself if you are going to share the implementations along other web projects, if so then you could create a seperate project called NameOfProject.Web.Mvc and put all your mvc related stuff, like the Membership and Role provider, HtmlHelpers, Filters etc. here.
I use the same approach to seperate my REST services, based on Web API from the MVC project by moving them to a seperate project called NameOfProject.Web.Http. This way it's very easy to build another client, like a console or winforms application that use the same service implementation as your other clients.
Here's an example of my project structure without a seperate project.
Example with a seperate project for MVC attributes
I hope this helps!
Good luck!