Reputation: 35
For a school project i have to make a movie streaming platform, i decided to develop this with the .net core MVC framework.
Currently my layered architecture looks like this:
The MovieRepository.cs
contains all my CRUD operations, so in this class i am getting all the movies with the GetAll()
method and this is where my problem comes into play. Since i cannot have a reference from my Business Layer
to my Data Layer
because this will cause a circular dependency, there is no way i can get the list with movies that my GetAll()
method returns. I am still pretty new to the multi-tier architecture so i do not really know if its good practice to add another layer between my Business Layer
and Data Layer
where i put my repositories with my CRUD operations. Maybe a Persistance Layer?
I hope someone can tell me what the best way is to fix this problem and why.
Upvotes: 0
Views: 122
Reputation: 86
Other comments are suggesting to switch to the 'CLEAN architecture'. While these remarks are valid on their own, you mentioned it's for a school project. Because of this I would suggest to focus on 'the basics' and only moving on when you have a good understanding of how everything works. When you have that foundation, you might even figure out the shortcoming of such a setup on your own!
To answer your question: Yes, a common practice is to extract your entities to a separate project that can be referenced by your Business layer and your Data layer. Naming is never an exact science but often this new layer is referred to as the Domain layer.
Upvotes: 1