how to use the ADO.NET Entity Framework and Validation together with the catel

Sep 30, 2011 at 8:12 PM


I am using Ado.NET Entity Framework in my project
How can I handle a Validation Error in my ViewModel ?

Oct 1, 2011 at 10:20 AM


Entity Framework uses the Validation attributes to add validation. Catel supports the following cases:

1) The model implements IDataErrorInfo

2) The model implements INotifyDataErrorInfo

3) The mapped property or the property in the view model has validation attributes (yes, you can use the validation attributes on the view model as well if you like, be don't recommend that)


In other words, are you mapping the properties of the model correctly in your view model? Or what is your exact question?

Best regards,


Oct 1, 2011 at 9:52 PM

i don't have any  Knowledge about Validation In MVVM :)

would it be ok you help me out about implement  validation in term of MVVM

Because i know about validation in general

 Can you explain more about the implements INotifyDataErrorInfo Or introduce an article or simple example 

I used the following Items in Catel Project 


Customer Model

Order Model




CustomerViewModel  -- Actions --> CRUD

OrderViewModel       -- Actions --> CRUD


I really appreciate your help

Oct 2, 2011 at 9:07 AM
  1. The first step is to add validation to entity framework. Here is an excellent article about validation in Entity Framework
  2. Catel will now automatically take over all validation as long as you define the ModelAttribute with it
  3. Last but not least, you can add, remove or customize validation in the ViewModelBase.ValidateFields method. See this documentation for more information.
Oct 14, 2011 at 8:14 PM

hi geert

I'm new to WPF &  MVVM 

Do you can, please, put a complete example using a Entity Framework 

Oct 15, 2011 at 6:36 AM

Hi Sarapersi,

Creating a full example with EF is a bit out of scope, and there are other priorities first. However, it's very simple, because you can create a new Silverlight application using the Catel project templates. Then, add a DAL (Data Access Layer), and finally add a domain service class to your web project.