Skip to content
Advertisement

How to make lookup field work in this case without defining the foreign key in the database?

The code is as follows (database first):

C# code:

UserTypeId is mapped, UserType is not. Any ideas how to make it work?

Advertisement

Answer

If we consider this as one to many relationship. Then Mapping using dataanotation will be like this.

And to query

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement