开发者

NHibernate: why do non-persistent properties have to be marked as virtual for lazy loading

I kind of get that in order to allow lazy loading, NHibernate needs to generate a proxy class which extends the POCO class. And so I guess NHibernate needs开发者_高级运维 to override the implementation of the persisted properties, and you have to mark them as virtual.

What I don't get is why I have to go round marking almost everything else as virtual as well. For example, I had to mark an IsValid property, which refers to the other properties but obviously isn't itself persistent, and bizarrely I had to mark all the events the class can emit as virtual too.

Anyone know why this is? I'm just curious.

Thanks

David

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜