Hello everybody,
I am having a difficult time understanding two design approaches in terms of long time extensibility in my current ASP.NET MVC application.
The ORM that I use for providing data is Linq2SQL. Which is just amazing to work with, BTW!
Now I am having some trouble with the design of my model classes for my views. Currently I've got a partial class for each entity in the database.
- This approach allows me to extend the class without having to switch the
strongly typedmodel on my views - I can easily add further properties for extra data (mostly meta)
- I can easily add helper methods which populate lists for me and/or do other data transactions
- One problem remains:
- I can't create a custom
constructoras this is already managed byLinq2SQL
- I can't create a custom
After reading the ASP.NET MVC Book and some tutorials, I see a very common use of FormViewModels for providing extra data on an object.
Currently I am very comfortable with the partial class design for my entities. But I wouldn't mind switching the design as I am still building the application.
What are the benefits of the FormViewModel instead of an easy partial class approach and what are the best practices in this matter?
All help is more than appreciated!