Using Transient properties (not persistent/ mapped) in Interceptor after Session.Merge() #2658

22 views
Skip to first unread message

Michal Krajcovic

unread,
Feb 2, 2021, 3:26:54 PM2/2/21
to nhusers

Hi guys,

lately I ran into an issue when I'm using Interceptors derived from EmptyInterceptor to generate some properties (i.e. Created and LastModified) on my entities. For some use cases I don't want to regenerate those values so I have transient (not persistent) property and in Interceptor I'm checking whether I should or should not generate those values. However after calling Session.Merge() those properties are always restored with default values (as NHibernate is not aware of them so it's not mapped).

I found that DefaultMergeEventListener is responsible for mapping properties but I'm not able to find a way to trigger mapping of some specific Transient values.

I tried some specific MergeEventsListener but that's already late.

Do you have any idea how to solve this issue?

Thanks in advance.

Reply all
Reply to author
Forward
0 new messages