开发者

Using Data Annotation Validators with the Entity Framework

I am working on WPF application which uses Entity Framework alongwith POCO classes. I would like to use data annotations with POCO classes for Client side validations in UI (WPF). Since, 开发者_运维百科I can't modify the POCO classes (it will be regenerated after updating the entity model), therefore, I have implemented the data annotations using partial class as per approach mentioned in the article: http://www.asp.net/mvc/tutorials/validation-with-the-data-annotation-validators-cs under section "Using Data Annotation Validators with the Entity Framework". Somehow this approach is not working in my case. Can anybody suggest something as to how can I use data annotation with Entity Framework?


You might have a look at the BookLibrary sample application of the WPF Application Framework (WAF). It shows how to use data annotations with the Entity Framework. And it shows how to consume it in WPF so that the validation errors are shown.


There is no need to registered the Data Annotations. Just followed the steps mentioned in the article & its working now.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜