I have a dbcontext query to a MySql database using EF Core 2 fetching from my usermaster table.
My usermaster inherits from IdentityUser so that I can take advantage of .NET Core's user security features.
But I do not implement all columns in my child class. e.g. Email which is on PersonMaster because while all users are people not all people will be users.
The autogenerated select statement arising from this snippet is pulling in columns from both the parent and child classes
CUserMasterLocal dbEntry = context.UserMaster
.FirstOrDefault(u => u.p_Username == user.p_Username);
How do I restrict it to just pull from the child class?
What I have tried:
I have tried implementing one of the columns that is not required in the child class with the
[NotMapped]
attribute. It had no effect.
Later today I will try something like this:[
^] to see if it delivers for me.
Regardless of this issue it looks like good practice, because if my Oracle days taught me anything all those years ago, surplus columns in a select kill performance.