问题描述
我在调整查询中的集合时遇到问题。
我已将问题分为三个阶段。
var allAccountsQuery = session.QueryOver(() => accountAlias)
.Where(account => !account.IsDeleted)
.Inner.JoinAlias(account => account.Owner,() => ownerAlias,o => o.Id == owner.Id)
.TransformUsing(new distinctRootEntityResultTransformer());
第二阶段:-我正在将余额提取到我的帐户中。
AccountBalance accountBalance = null;
allAccountsQuery = allAccountsQuery
.Left.JoinAlias(account => account.AccountBalances,() => accountBalance,balance => !balance.IsDeleted)
.TransformUsing(new distinctRootEntityResultTransformer());
第3阶段:之后,我尝试使用投影条件操作根据以下条件填充一些属性。
allAccountsQuery = allAccountsQuery
.SelectList(list => list
.Select(() => accountAlias.Id).WithAlias(() => accountAlias.Id)
.Select(() => accountAlias.AccountNumber).WithAlias(() => accountAlias.AccountNumber)
.Select(() => accountAlias.CoreAccountId).WithAlias(() => accountAlias.CoreAccountId)
.Select(() => accountAlias.sourceId).WithAlias(() => accountAlias.sourceId)
.Select(() => accountAlias.Changed).WithAlias(() => accountAlias.Changed)
.Select(
Projections.Conditional(
Subqueries.Exists(
QueryOver
.Of(() => history)
.Where(() => history.Account.Id == accountAlias.Id && history.ValidFrom <= datetocheck && history.ValidTo >= datetocheck)
.Select(x => x.Account.Id)
.DetachedCriteria) // this is the SUB-SELECT,Projections.SubQuery(
QueryOver
.Of(() => history)
.Where(() => history.Account.Id == accountAlias.Id)
.Select(x => x.AccountDescription)
.Take(1)
),Projections.Property<Account>(p => p.Description)
)
)
.WithAlias(() => accountAlias.Description)
)
.TransformUsing(new DeepTransformer<Account>());
问题:现在,我想放下我从第二阶段获取的收藏集。经过一些研究,我发现下面的内容。让我知道正确的看法。
https://github.com/nhibernate/nhibernate-core/issues/945
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)