无法创建 'LookupObject' 类型的常量值。在此上下文中仅支持原始类型或枚举类型
Unable to create a constant value of type 'LookupObject'. Only primitive types or enumeration types are supported in this context
我该如何解决这个问题?
我需要在数据库和内存对象列表之间进行检查
var contactIds = db.AGN_RestrictionContact_Involvement_PositionLinked
.Where(x => x.Id_AGN_Contato == formModel.ContactId);
var positionRemove = contactIds.Where(x => !formModel.PositionsInvolvement
.Any(l => l.Id == x.Id_PRO_PosicaoEnvolvido)).ToList();
foreach (var position in positionRemove)
{
db.AGN_RestrictionContact_Involvement_PositionLinked.Remove(position);
}
我设法达成了一个简单的解决方案,我将其添加到此查询的末尾=>
var contactIds = db.AGN_RestrictionContact_Involvement_PositionLinked
.Where(x => x.Id_AGN_Contato == formModel.ContactId).ToList();
ToList()
查询也将保留在内存中,以免在我的 viewModel 中引起问题 'PositionsInvolvement' 属性
我该如何解决这个问题?
我需要在数据库和内存对象列表之间进行检查
var contactIds = db.AGN_RestrictionContact_Involvement_PositionLinked
.Where(x => x.Id_AGN_Contato == formModel.ContactId);
var positionRemove = contactIds.Where(x => !formModel.PositionsInvolvement
.Any(l => l.Id == x.Id_PRO_PosicaoEnvolvido)).ToList();
foreach (var position in positionRemove)
{
db.AGN_RestrictionContact_Involvement_PositionLinked.Remove(position);
}
我设法达成了一个简单的解决方案,我将其添加到此查询的末尾=>
var contactIds = db.AGN_RestrictionContact_Involvement_PositionLinked
.Where(x => x.Id_AGN_Contato == formModel.ContactId).ToList();
ToList()
查询也将保留在内存中,以免在我的 viewModel 中引起问题 'PositionsInvolvement' 属性