开发者

Entity Framework 4.1 Code First: How is the Discriminator determined?

Currently I have class hierarchy defined with the Code First approach as follows.

Entity Framework 4.1 Code First: How is the Discriminator determined?

E.F. has autogenerated a nvarchar(128) discriminator. It is not a key field.

How does Entity Framework determine what and what Type the discriminator field should be, and is it always the same, i.e. nvarchar? Is the discriminator at all accessible out开发者_运维问答side the database i.e. from LINQ to Entity?


Discriminator column is by default nvarchar because it stores names of your classes to differ between types - that is the whole point of this column: to allow EF knowing what class instance from your inheritance hierarchy it should create when it loads record from the database.

Discriminator column is not accessible by linq-to-entities. It is only used to map record to correct type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜