0

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?

6
  • And what is the question? You have already found solution. Commented Mar 15, 2011 at 10:49
  • I am not able to make it working using Partial classes. Can you suggest something ? Commented Mar 15, 2011 at 11:04
  • If I specify the data annotations in POCO classes, it started working fine but not as per the approach mentioned in the above article. Any ideas ? Commented Mar 15, 2011 at 11:18
  • That approach is the solution. If it doesn't work for you, post the related code so that we can try to figure out the problem. Commented Mar 15, 2011 at 12:30
  • How are you using dataannotation in wpf. Post some code. Commented Mar 15, 2011 at 13:40

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.