I have an ASP.NET MVC3 in C# and Razor. The architecture of the application is divided in Data Access Layer (EF classes + Repository), Service Layer, Controller, ViewModels and View.
My application is a dashboard, it has to display statistics about products by using graphs.
Assume I have Product
and ProductCategory
tables and in a graph I have to display the percentage of sold Products
per ProductCategory
per Month. In the x-axis I have the months, in the y-axis the percentage ProductPerCategory/ProductTotal and therefore I have as many lines as ProductCategories
.
In this case my Domain Model is made by Product
and ProductCategory
objects on the EF. My repository gives these domain objects to its upper layer (Service Layer).
My Business Model is made by the ProductGraph
object and my Service Layer gives this business object to its upper layer (Controller).
My controller take this ProductGraph
object and map it to the View Model ProductGraphViewModel
to be displayed in the view.
Is this distinction between models correct? Is there any shortfall or bad approach on the definition of the objects passed between layers?