问题描述
我正在使用 EF 6 和 Z.EntityFramework.Extensions。
以下代码:
using (var context = contextFactory())
{
var modified = context.Receita.
Where(r => r.V_UID == receitaEletronica.vendaUid && r.numeroreceita == receitaEletronica.NumeroReceita).
Join(context.Tabela_Comparticipacao.
Where(t => entidades.Contains(t.ec_uid)).
Join(context.Tabela_Comparticipacao.Where(t => t.flag_elect == 1),source => source.ec_uid,dest => dest.ec_uid,(source,dest) => new { Source = source,Dest = dest }),r => r.TaCo_UID,t => t.source.TaCo_UID,(r,t) => new { Receita = r,NovoTaCo = t.Dest.TaCo_UID }).
UpdateFromQuery(r => new Receita { TaCo_UID = r.NovoTaCo });
}
抛出以下异常:
Message:
Test method winphar.services.receitas.ReceitasDAOTest.TestAtualizarReceitaElectronicaTaCoUidEntidadesCentralizadas threw exception:
System.Exception: Oops! Invalid update expression,the body is not a NewExpression. Please refer to the documentation to get examples about how to use this feature.
Stack Trace:
DbContextExtensions.[](IQueryable`1 ,Expression`1 ,Action`1 ,Boolean )
DbContextExtensions.UpdateFromQuery[TEntity](IQueryable`1 query,Expression`1 updateExpression,Action`1 bulkOperationFactory)
DbContextExtensions.UpdateFromQuery[TEntity](IQueryable`1 query,Expression`1 updateExpression)
ReceitasDAO.AtualizarReceitaElectronicaTaCoUidEntidadesCentralizadas(ReceitaEletronica receitaEletronica,List`1 entidades) line 114
ReceitasDAOTest.TestAtualizarReceitaElectronicaTaCoUidEntidadesCentralizadas() line 267
我做错了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)