DBcontext validation
Data validation is a critical component of any data-centric application, so it may come as a surprise to discover that Entity Framework doesn’t provide a validation API. Instead, it depends on standard .NET techniques. If you’re using the ObjectContext
API, that means handlng property changing events or extending the SaveChanges()
method (or adding your own validation layer, which is pretty advanced stuff). The DbContext
API, however, adds support for the IValidatableObject
interface, which not only provides a powerful mechanism for validating entities, but integrates with other .NET technologies and tools. Here’s how DbContext ...
Get Fluent Entity Framework now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.