Entity Framework 4.1, RIA Services and the [Include] attribute
Found a nugget yesterday with an Entity Framework 4.1, RIA Services Silverlight project.
I’d spent some time upgrading the solution to EF4.1 and using plain classes. Data access in itself was working fine and was a very worthwhile upgrade from Linq2Sql.
However having escaped the highly annotated classes from my DTO project, I realised I still needed to use the [Include] attribute to tell RIA services which associates need sending to the client.
So, from the data access perspective, I use .Include(p => p.ReferencedEntity) to ensure the entity is retrieved from the database, and:
[Include]
public virtual SomeClass ReferencedEntity { get; set; }
… to ensure it’s sent to the client via RIA.
