Rafael A. M. S.
Rafael A. M. S.

Reputation: 637

Entity Framework mapping a Navigation Property as Scalar property

Im trying to generate a model from a database. The model is being generated but all the foreign key fields (that should be only navigation properties) are being mapped as Navigation Property and a scalar property (IN THE MODEL).

I know the foreign key is added in the end of the multiplicity on database but whenever I generate a database from model, all the entity classes doesn't contain that field.

Is there a way to ignore this field generating the model from database?

Upvotes: 1

Views: 1435

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364249

When you generate the model from the database there is a check box called Include foreign key columns in the model. This check box is by default selected. If you deselect it your model will not contain foreign key properties but just navigation properties.

Upvotes: 4

Related Questions