Sharing validation code between a WPF client, a WCF Service and Entit(blogs.infosupport.com)
submitted by
alexb(268) 11 months, 27 days ago
Recently Entity Framework 4.1 was released. 4.1 contains a DBContext class, which is largely a wrapper around the ObjectContext class with a simplified API. Now you might think as I did: “But if I’m comfortable with the ObjectContext class and I don’t use code first, why in the world would I need a DbContext?”. The answer is pretty simple. The DbContext has a feature which simply isn’t supported by the ObjectContext: data validation with the attributes from the System.ComponentModel.DataAnnotations namespace. In this article I’ll show you how to decorate your classes with validation attributes and how these classes can be reused by both the client and the server.
|category: ADO.NET
|Views: 171
tags:
ADO.NET Database another
Everyones tags:
Your Tags: