NHibernate: why mutable properties should be marked as virtual for lazy loading

Be that as it may, to ensure lazy loading of NHibernate, you must create a proxy class that extends the POCO class. And so, I assume that NHibernate should override the implementation of persistent properties, and you should mark them virtual.

What I am not getting is why I have to bypass the mark of almost everything else as virtual. For example, I had to mark the IsValid property, which refers to other properties, but obviously is not persistent, and I had to bizarrely flag all events that the class can also generate as virtual.

Does anyone know why this is? I'm just curious.

thank

David

+3
source share

Source: https://habr.com/ru/post/1754316/


All Articles