开发者

How to get client validation with RIA services working with POCO?

开发者 https://www.devze.com 2023-01-23 21:13 出处:网络
I\'m starting up with Entity Framework and RIA Services. I\'m also evaluating whether to use POCO or not, I believe it is the way to go since we will work on an agile (scrum) environment... (so far)

I'm starting up with Entity Framework and RIA Services. I'm also evaluating whether to use POCO or not, I believe it is the way to go since we will work on an agile (scrum) environment... (so far)

With the self-tracked entities I could add decorators on the metadata in order to get client-side validation. How can I achieve the same with POCO classes? I wouldn't want to modify generated files, cause they will be genrated tons of times bie开发者_如何学运维fore the final release and (of course) I don't want to write my validation code every time.


Can't you continue to do it with partial classes and metadata types? Something like this.

[MetadataType(typeof(MyEntity.Metadata))]
public partial class MyEntity
{
  private class Metadata
  {
    [Required]
    [StringLength(5)]
    public string MyProperty;
  }
}
0

精彩评论

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