Those of you who know what I am talking about will probably also know that we have been saying publicly that the Entity Framework doesn't support them.

Now for those who don't know what an association with a payload is, imagine something like:

Order <- (1-*) -> OrderLine <- (*-1) -> Product

An OrderLine is an Entity in it's own right, it has an identity, an FK point to the Order and an FK pointing to the Product, and extra properties like a Quantity for example.

Conceptually however you can also think of the OrderLine as being a Many-2-Many association, that associates Orders with Products, and additional has a payload: the Quantity.

Order <- (*-*) -> Product

Now the benefit of being able to treat the OrderLine as an association as well as an Entity is that you can replace 2 step navigations (Order.OrderLines.Product or Product.OrderLines.Order) with one step navigations (Order.Products or Product.Orders).

So for example I could write something like this:

var products = from o in ctx.Orders
                          from p in o.Products
                          where o.OrderNo = 454
                          select p;

When the Entity Framework tools encounter a pure Many-2-Many join table that has only 2 columns, both of which are Foreign Keys, it creates an Association instead of an Entity. But if the table has more columns, like OrderLine which has a PK and a Quantity, then an entity is created instead.

So the Entity Framework doesn't support Associations with Payloads natively.

It turns out however that with a little jigger pokery in the CSDL, MSL and SSDL it does support them, sort of.

In my next post I'll show you how, and explain the limitations.