I'm very busy with the architecture of a new MVC application, but i'm getting very confused about how to manage different type of objects. The confusion is about the relation between entities, business objects and viewmodels. I 'm going to describe my confusion with an example:
I've set up my web application with different projects: MVC frontend, BLL, DAL, Common things etc.
Let's say i have a view with a List of bikes. I want to display the bike details like color, size, manufacturer. But in my database, the Bike and Manufacturer are two different tables, so in my Entity Framework context, these are also two different classes.
So i have these two entities Bike and Manufacturer. But in my business needs, i think they need to be a single object, which i can manipulate or use in business logic. Then there is my view, which needs a (View)Model. That should also be a combined ViewModel with properties from different tables.
How do i handle this? Do i need to get the Bike and Manufacturer object from my DAL, and create a business object from it in my BLL, and after doing some business logic, should i create a ViewModel from it in my controller? Or does my DAL need to return a combined business object? Or can i use the entity object as business classes? Or can i also use my business object as a ViewModel?
I hope that my problem is clear and that anyone can give me a good advise about which object are needed and how, where and when the different types of objects are created, and in which layer this classes should go...