I have big asp.net web-forms
project, I'm using Linq2SQL
, I have 1 model per table (same properties as generated classes by Linq2SQL, I add this models to have more controls of fields).
For some tables I need multiple ViewModels, for example for Product table I have following models:
ProductBaseViewModel
containsId
,Title
,Price
ProductPageViewModel
derived fromProductBaseViewModel
and haveDescription
andReview
propertiesProductBoxViewModel
containsId
,StockCount
,Title
,Url
andFormattedPrice
ProductWebApiViewModel
I use this one inAPI
layer- I have 3 more ViewModels that related to
Product
!
I think having this kind of models are silly and I'm looking for some better solution, is there better way (I'm sure the answer is yes) for handling ViewModel
s in large projects?
Thanks in advance.
Description
field every time I select a product it's NVARCHAR(MAX) so I need one model without that. I hope I could mention the point.