I've EF Code First data context, as well as for some tables (codebooks) dynamic data web application can be used for administration. When entity is produced through DD interface, everything looks ok, for instance after i produce a Book, that has property of type Author named Author, I recieve to select author by title from dropdown list.

The issue is when saving entity, that property in Book entity is null, and that i cannot try to a minimum of read Id of selected author in dropdown in codebehind (Place.aspx.cs). Regrettably, I do not have Id of Author as property in Book, only whole Author object.

Can there be in whatever way to beat this issue in DynamicData?

One method to overcome this really is to possess ID of recommended entity like a property, with

[ForeignKey("ReferencedEntityPropertyName")]
public int ReferencedEntityPropertyId {get; set;}

attribute, where ReferencedEntityPropertyName is Author within this situation.

By doing this, dynamic data page sets id of recommended object into corresponding property and everything works fine.

This, however, isn't the most effective solution within this situation as imposes changes to entity models, which isn't what I love to do when relaxation of product is working if you will find no real unit tests to ensure this ain't broke something.