NHibernate: conditionally load calculated column

I have the following property

<property name="Allocated" type="decimal" formula="(select sum(a.AllocationAmount) from  Allocation a where  a.TransactionId = TransactionId)" />

This loads the transaction amount that has been allocated for invoices that work beautifully.

However, in most cases, I do not need this amount. Is there a way to conditionally load this computed column? Or is there a way to add this computed column to HQL / Critera so that I can just make it part of some specific queries that I ran?

+3
source share
2 answers

access="none" , , , hql. . .

, , , / , api ( Projections.SqlFunction)

+2

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


All Articles