Jul 08, 2020 11:23 AM|mgebhard|LINK
I think i mentioned what im after above a couple of times. I know how to create a Repository but my question is how to separate this structure into separate projects.
Sorry, it's confusing that you created a repository pattern but at the same time it appears like you do not understand Interfaces. The interface is the separation between the data access layer (EF or ADO) and the UI or business layer. It is like a switch
where you get to point your code to a different data source. I assumed since you know how to design an generic repository which is a advanced topic that you understand the interface is the hard separation.
Create a project for Entity Framework which contains the EDMX. Create another project for the Unit of Work and repositories, Create a project for the Web Forms application. Create a project for the unit tests. You might create a separate business layer
or your business layer might end up in the repo. Depends on your skill level. Generally wrapping Entity Framework, which is already a Unit-of-Work, with another Unit-of-Work causes problems when you get to the real work of building the application. That
work is designing and writing code that meets business requirements. In other words, the UoW is an abstraction that you build before solving the actual business problem with code.
The references look like the following.
Web App -> UoW(Repos) -> EF
If you create a business layer
Web App -> Business -> UoW(Repos) -> EF
If you create a service layer on top of the business layer
Web App -> Service -> Business -> UoW(Repos) -> EF
Unit test -> business -> UoW(Mock Repos) (sample shown above above)