开发者

Get EntityKey without loading referenced Entity

开发者 https://www.devze.com 2023-01-11 20:57 出处:网络
is it possible to get entity key from EntityReference property without loading it? I tried: entity.EntityKey.EntityKe开发者_如何学GoyValues[0].Value

is it possible to get entity key from EntityReference property without loading it?

I tried:

entity.EntityKey.EntityKe开发者_如何学GoyValues[0].Value

But if referenced entity isn't loaded by EntityReference.Load() method, EntityKey property is null.

Thank's a lot!


In EF 4, use FK associations instead of independent associations if you want this feature.

For EF 1, EntityKey will be null if the query.MergeOption is MergeOption.NoTracking.

0

精彩评论

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

关注公众号