I have a scenario whrere I am using EF4.x for the ORM.
In order to add data annotations I am using a partial class and the MetaDataType attribute to add annotations for validation on the view.
My issue is that in some cases the validation may be different. Depending on the application. How can ochestrate this so that for different viewmodels which iherit from the Entity in the EF, I can apply different Meta data for different Apps
Actually, I solved it. Simple really, I simply switched my partial class to the class of my viewmodel which also had to be made partial and applied the same method as above.
Marked as answer by gelpack on Feb 09, 2013 12:44 PM
Gelpack
Member
159 Points
124 Posts
Entity Framework + Multiple Validations Annotations Depending on Application
Feb 09, 2013 10:37 AM|LINK
I have a scenario whrere I am using EF4.x for the ORM.
In order to add data annotations I am using a partial class and the MetaDataType attribute to add annotations for validation on the view.
My issue is that in some cases the validation may be different. Depending on the application. How can ochestrate this so that for different viewmodels which iherit from the Entity in the EF, I can apply different Meta data for different Apps
Gelpack
Member
159 Points
124 Posts
Re: Entity Framework + Multiple Validations Annotations Depending on Application
Feb 09, 2013 12:44 PM|LINK
Actually, I solved it. Simple really, I simply switched my partial class to the class of my viewmodel which also had to be made partial and applied the same method as above.