I'm developing a Silverlight application with Entity Framework and RIA Services. When I create the RIA Service I have the option to generate a metadata class for basic validation.
What is the difference between the validation I can do directly with EF and the one in the metadata class generated with RIA service? I mean, if I have a property in the EF model which is not null, I don't need to mark it in the metadata c开发者_Python百科lass as [Required]... Is it because this is already done by the EF model??
THANKS!
With the metadata classes you can add more validation logic to your entities. See the namespace System.ComponentModel.DataAnnotations for more details. EF currently only supportes the Required attribute. The namespace provides more attributes, such as RangeAttribute, StringLength or custom attributes that you define for your own validation logic.
Jeff Handly has a good series of blog post, that describe the validation process and elements in WCF Ria Services.
精彩评论