I use EF4.3.1 in .Net4.0 web forms (not MVC!).
I am using the repository template with the IUnitOfWork interface. But I wonder if I follow the best practices, especially since most of the examples I used are based on MVC applications.
I will only say this to a small web application, so this may affect the choice of solution.
Currently, the solution has 3 projects: model, logic and website. The model contains codefirst objects and the IUnitOfWork interface. Logic contains repositories and service levels. The site obviously contains a website, codebehind, etc.
I do not use a third-party injection tool (ninject, etc.). I manually add repositories using IUnitOfWork ie
public BookingRepository (IUnitOfWork unitOfWork)
I do not know what to do with service levels if IUnitOfWork also exists in the Site project or exists only in the Logic and Model layers.
I am currently inserting a repository and unit of work into a service, i.e.
public BookingService (IUnitOfWork unitOfWork, IBookingRepository repository, IAppSettings appSettings)
But this means that commiting (save to db) is done at the site level, but I wonder if it should be done at the service level. It also means that since my IUnitOfWork is declared in my model layer, I also need a link to the Model on my site.
What can I do better? Am I doing something right? lol