我试图执行以下法典。 但是,这部法典打破了。
Dim complaints = From comp In Me.Db.Complaints _
Let varX = GetVariations().WithVariationId(If(comp.ItemPropertyXVariationId, 0)) _
Let varY = GetVariations().WithVariationId(If(comp.ItemPropertyYVariationId, 0)) _
Select New Hogia.Retail.POS.Data.Complaint() With _
{.ItemXVariation = If(varX Is Nothing, DirectCast(String.Empty, String), varX.Name)}
。 项目十五 现在,我以以下方式在准则说明之外测试了该法典的行文,并且进行了罚款,并按预期结果恢复了适当结果。
Dim varXX = GetVariations().WithVariationId(0)
Dim varYY = GetVariations().WithVariationId(0)
Dim temp As New Complaint() With {.ItemXVariation = If(varXX Is Nothing, DirectCast(String.Empty, String), varXX.Name)}
请允许我帮助我理解一下,为什么在第一个部分,该守则会中断。 这里的错误。
这里要传达的信息(帮助我说出这一点)
Could not translate expression Table(Complaint).Select(comp => new VB$AnonymousType_22
(comp = comp, varX = Invoke(value(System.Func
1[System.Linq.IQueryable1[
Data.ItemPropertyVariation]])).WithVariationId((comp.ItemPropertyXVariationId ?? 0)))).Select($VB$It1 => new VB$AnonymousType_3
2($VB$It1 = $VB$It1, varY = Invoke(value(System.Func1[System.Linq.IQueryable
1[Data.ItemPropertyVariation]])).WithVariationId(($VB$It1.comp.ItemPropertyYVariationId ?? 0)))).
Select($VB$It => new Complaint() {ItemXVariation =
IIF((Convert($VB$It.$VB$It1.varX) = null), null, $VB$It.$VB$It1.varX.Name)})
into SQL and could not treat it as a local expression.