Browse by Tags
All Tags »
Entity Framework (
RSS)
Back to Entity Framework Code First (EFCF) validation. On my previous post I mentioned that EFCF did not support fluent validation. While this is true, it isn’t too hard to implement one such mechanism, which is exactly why I am writing this! I will be...
Introduction Most persistence frameworks implement some kind of custom validation of entities before they are sent to the database. By custom I mean something more than just “is not null”, “has XX characters”, etc. This typically includes individual properties...
Introduction In some O/RMs, it is possible to specify automatic filters for entity collections such as one-to-many or many-to-many. These are applied automatically whenever these collections are being populated. Entity Framework does not offer one such...
This is a short post to complement my previous one on Entity Framework Code First Inheritance : how to query for a specific class. The options are: From the DbContext collection: 1: IEnumerable<DerivedA> derived = ctx.Bases.OfType<DerivedA>...
Introduction Another post for self reference, this time, how to map inheritance strategies with Entity Framework Code First. Single Table Inheritance / Table Per Class Hierarchy First, the default strategy: one table for all classes in the hierarchy....
Introduction This post is more for self-reference than anything else. Basically, I tend to forget some options for mapping relations with Entity Framework Code First, so I wrote this. If in doing so it helps someone, even better! One-to-Many First, the...
Sometimes we may be faced with the need to load entities dynamically, that is, knowing their Type and the value(s) for the property(ies) representing the primary key. One way to achieve this is by using the following extension methods for ObjectContext...
A friend of mine has found the following problem with Entity Framework 4: Two simple classes and one association between them (one to many): One condition to filter out soft-deleted entities ( WHERE Deleted = 0 ): 100 records in the database; A simple...
Introduction NHibernate and Entity Framework are two of the most popular O/RM frameworks on the .NET world. Although they share some functionality, there are some aspects on which they are quite different. This post will describe this differences and...
One thing I didn’t refer on my previous post on ASP.NET MVC CRUD with AJAX was how to retrieve model validation information into the client. We want to send any model validation errors to the client in the JSON object that contains the ProductId , RowVersion...
More Posts
Next page »