EasyData icon indicating copy to clipboard operation
EasyData copied to clipboard

Show data for shadow foreign key properties

Open korzh opened this issue 3 years ago • 2 comments

When we define a model class like this

public class Culture 
{
    public string Id { get; set; }
    public Language Language { get; set; }
    .     .     .     .
}

Entity Framework automatically adds the LanguageId property to the Culture entity.

Currently, we just skip these properties (both on metadata loading and on data fetch) but it would be more correct to show them (unless the user skips them on purpose) and to retrieve the data from the corresponding fields.

korzh avatar Jan 14 '22 22:01 korzh

It could be problematic because during adding or editing we cannot set navigation property via existing mapping. It will require special mapping for shadow attributes if we will show them.

antifree avatar Jan 15 '22 12:01 antifree

It could be problematic because during adding or editing we cannot set navigation property via existing mapping. It will require special mapping for shadow attributes if we will show them.

Actually, adding or editing will be much easier than getting data: https://docs.microsoft.com/en-us/ef/core/modeling/shadow-properties#accessing-shadow-properties

korzh avatar Jan 16 '22 14:01 korzh