I am creating a solution from scratch, using ASP.NET Web forms C#.
I am concerned about the model objects as I don’t want to create duplicate sets of model objects in each layer. What is the best practice for using Model objects in 3 layer architecture in Web Forms?
The structure I have in mind is as follows:
- UI
- BLL
- DAL
- Model
The Model will contain all the model classes that can be used in each section of the layers. I thought this would be useful as each layer needs access to the model objects. For example:
- UI calls a method in BLL passing in a model object filled with data.
- BLL calls a method in DAL passing through the object which is saved
in the database etc.
Thanks
look at my answer here: https://stackoverflow.com/a/7474357/559144 this is the usual way I do things and works well, not only for MVC and Entity Framework… in fact in MVC the model could be an entity type which only has some of the fields contained by the real business entities defined in lower layers, it depends if you really absolutely need all fields in the UI level as well or only some to do some data rendering and input…