问题描述
balanceQuery = balanceQuery
.JoinAlias(balance => balance.Account,() => accountAlias)
.Where(() => accountAlias.Owner.Id == owner.Id && !accountAlias.IsDeleted);
然后,我在下面的子查询中使用并调整我的描述值。
var projection = Projections.Conditional(
Subqueries.Exists(
QueryOver.Of(() => history).Where(() => history.Account.Id == accountAlias.Id)
.Select(accountHistory => accountHistory.Account.Id).DetachedCriteria),Projections.SubQuery(
QueryOver.Of(() => history).Where(() => history.Account.Id == accountAlias.Id)
.Select(accountHistory => accountHistory.AccountDescription).Take(1)),Projections.SubQuery(
QueryOver.Of<Account>().Where(account => account.Id == accountAlias.Id)
.Select(account => account.Description).Take(1)));
为了进行选择,我使用了下面的选择列表。
balanceQuery
.SelectList(list => list
.Select(balance => balance.Id).WithAlias(() => accountBalanceAlias.Id)
.Select(balance => balance.AmountDebit).WithAlias(() => accountBalanceAlias.AmountDebit)
.Select(balance => balance.AmountCredit).WithAlias(() => accountBalanceAlias.AmountCredit)
.Select(balance => balance.Period).WithAlias(() => accountBalanceAlias.Period)
.Select(balance => balance.AccountBalanceType).WithAlias(() => accountBalanceAlias.AccountBalanceType)
.Select(balance => balance.Changed).WithAlias(() => accountBalanceAlias.Changed)
.Select(balance => balance.Created).WithAlias(() => accountBalanceAlias.Created)
.Select(Projections.Property(() => accountAlias.Id).As("Account.Id"))
.Select(Projections.Property(() => accountAlias.AccountNumber).As("Account.AccountNumber"))
.Select(Projections.Alias(projection,"Account.Description"))
.Select(Projections.Property(() => accountAlias.Created).As("Account.Created"))
.Select(Projections.Property(() => accountAlias.Changed).As("Account.Changed")))
.TransformUsing(new DeepTransformer<AccountBalance>());
现在,我要删除的是选择列表上方的内容。因为,我不想选择每个属性。我只想让DeepTransformer做我的工作。
有什么方法可以代替选择每个属性。我们可以进行一次查询吗?可以在一次查询中转换所有属性。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)