I have to separate ViewModels from my Business Model (Data Access Layer) in a separate library in my MVCC project. Assuming that I have database access level classes in a separate library. Our primary project (MVC) does not know anything about those sections and they talk to each other through an interface IOC's It is easy to use and the dependency injection is to solve by nignging or using something else, okay?
Now in DataSeller the car named category includes the engine and wheel properties in my MVC project (which does not know anything about DataAccessless and its classes) I need to use some car objects So I have another car class (this is just a pure view model) and it has only one quality. There will be some differences in the engine and the wheel (of course, in the actual app, for the relativity between models and view models, which do not pay attention to it)
The IDataAccessLayer interface is a method called IEnumerable GetAllCars that is DataAccessLayer. The car gives a list of items Now I need to create MVCProject.Car archive, Repeat through that was returned by GetAllCars (), on every move Uje need to create a new MVCProject.Car object, tap the engine and wheel properties, and add the object to the end of the collection.
Therefore: every time I make almost identical structures and somehow manage them at different places.
Here's the problem, see? Or is not it? I think it will end in big disturbances if I can not change it myself repeat the principle violation because it is. Please tell me how to make it right, I do not know behind the scenes or prototype or maybe some other design patterns which I suck anyway. Or some kind of equipment like Nineg (which I know only about using the IOC container) or the automaker or whatever, which I have to suck even more than sucking in the design pattern
I do not even see a reason to keep the DAL separate from the MVC layer. If you are interested, then it is a layout which I have used for many projects and I think it is very useful and flexible.
DataObjects also includes enumeration using data objects. Receive DataAccess from DataObjects and add GetByPrimaryKey, GetByForeignKey, GetByUniqueIndex, GetAll, etc. It also includes a caching layer, where you will find staticache, countrycache, etc. for quick access to things often used. The "GetBy" method will also use the caching layer, whenever possible. Logic includes static classes, logical functions other than simple fetches described in a DataAccess layer for each DataObact \ Access type. Web + front-end UI works with data aviators and logic layers for receiving and updating UI data as well as other calls defined logical APIs. I use my own custom-made code generator to generate 98% of this code (except for the UI layer).
Comments
Post a Comment