0

尝试将查询结果投影到整数列表中。如何做到这一点?应该用什么变压器。AliasToBean 不起作用,因为它需要 setter。

var accessFeeYears = _session.QueryOver<AgreementAccessFee>()
                        .JoinAlias(a => a.FeeType, () => agreementAccessFeeTypeAlias)
                        .Where(x => x.Agreement.Id == request.AgreementId
                                                             && agreementAccessFeeTypeAlias.Code ==AgreementAccessFeeTypeCode.FlatChargePerInsured)
                         .SelectList(list => list
                                        .Select(a => a.PolicyYear).WithAlias(() =>policyYear))
                         .TransformUsing(Transformers.??????)
                         .List<int>();
4

2 回答 2

2

另一种方式:

_session.QueryOver<AgreementAccessFee>()
    .JoinAlias(a => a.FeeType, () => agreementAccessFeeTypeAlias)
    .Where(x => x.Agreement.Id == request.AgreementId
        && agreementAccessFeeTypeAlias.Code == AgreementAccessFeeTypeCode.FlatChargePerInsured)
    .SelectList(list => list
        .Select(a => a.PolicyYear))
    .List<int>();

(一起摆脱TransformUsing所有)

于 2013-07-12T19:39:02.823 回答
0

这很容易,在查看了选项之后,PassThrough 看起来可以工作,而且确实有效。

于 2013-07-12T19:34:50.683 回答