What's the best way to validate EntityFramwork 4.0 classes?

Posted by lsb on Stack Overflow See other posts from Stack Overflow or by lsb
Published on 2010-04-16T11:40:32Z Indexed on 2010/04/16 11:43 UTC
Read the original article Hit count: 279

Hi! I've done a fair amount of searching but I've yet to find an easy way to validate EntityFramework 4.0 entities passed accross the wire via WCF Data Services. Basically, I want to do something on the client like:

        Proxy.MyEntities entities = new Proxy.MyEntities(
            new Uri("http://localhost:2679/Service.svc"));

        Proxy.Vendor vendor = new Proxy.Vendor();

        vendor.Code = "ABC/XYZ";
        vendor.Status = "ACTIVE";

        // I'd like to do something like the following:
        vendor.Validate();

        entities.AddToVendors(vendor);

        entities.SaveChanges();

Any help in this regard would be greatly appreciated!

© Stack Overflow or respective owner

Related posts about wcf-data-services

Related posts about ado-net-dataservices