Smartkid
Smartkid

Reputation: 1842

How to map a protected property in EF 4.3 code first

In EF 4.3 documentation says:

By default, building a database using Code First does not include private, protected, or internal properties. If you manually included these properties in your model, Code First would ignore any data annotations on those members. This is issue now fixed, and Code First processes the data annotations.

My question is how to included a protected property manully with code first, espically using fluent API?

Upvotes: 10

Views: 6345

Answers (2)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364259

It is not possible with fluent API because fluent API uses strongly typed approach and because of that all accessibility rules are still in place. Documentation says it should be possible with data annotations but I wasn't able to make it work.

Upvotes: 3

Related Questions