1

Closed

NotMapped property can't be add explicitly by model builder

description

The scenario is that I have some properties that I don't want to map to EF. So I set NotMapped to them. However I want to show them on odata. So I explicitly add those properties:
        var user = builder.EntitySet<User>("Users").EntityType;
        user.Property(u => u.CorrectAnswerCount);
        user.Property(u => u.TotalAnswerCount);
        user.Property(u => u.Rank);
But the code doesn't work. Those columns are still not shown up on the payload.
Closed Oct 11, 2013 at 5:48 PM by jacalvar

comments

HongmeiG wrote Mar 30, 2013 at 1:42 AM

Yes, it is a bug that our default convention should not override if someone has explicitly mapped the properties.

As a workaround, you can do this in the OnModelBuilding event on the conventional model builder, then it should just work.

raghuramn wrote Oct 9, 2013 at 6:04 PM