开发者

Buddy classes and ViewModels in MVC?

As far as I understand "Buddy Classes" is one way to add data annotations to an EF-crea开发者_StackOverflow社区ted class. To add values for a dropdown, or to use a subset of properties in a View however - a ViewModel is adviceable. Is that correct? Or can I combine the two in one buddyviewmodelclass?

This is a bit confusing. It would be awesome to model up a class with data annotations and all in EF designer.


Yes, you got it right. A view model is a class that reflects all the specific properties of a given view. This view model could be composed of multiple model classes or be a subset of a single model class. This will depend on your model classes and the requirements of your views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜