Validation of included entities

Aug 15, 2011 at 9:38 PM

Hi,

I'm creating an application using Silverlight and RIA Services. On a page, I'm displaying a Customer entity as well as his address, which is an other entity. For this, in my viewmodel, I've a property of type "Customer" and it's address property is set to a new entity of type "Address".

How can I validate the data when I want to save the Customer? The user should fill the data for the customer and his address. If both are valid, it should create a new "Customer" entity and a new "Address" entity.

If I write customer.Validate(...), it will validate the Customer entity and it will ignore its "Address" entity. Do I have to validate each entity one by one? As the "Address" entity is a property of the "customer" entity, isn't it possible to validate it as all other customer properties?

 

Daniel Varrin