【发布时间】:2015-11-03 12:46:58
【问题描述】:
我正在尝试使用以下代码更新表格
Dictionary<int, decimal> myDictionary = GetDictionary();
Context.Persons
.Where(t => mydictionary.Select(s => s.Key).Contains(t.Id))
.Update(t => new Person { Salary = mydictionary[t.Id] });
无法创建类型的常量值 'System.Collections.Generic.KeyValuePair`2[[System.Int32, mscorlib, 版本=4.0.0.0,文化=中性, PublicKeyToken=b77a5c561934e089],[System.Decimal, mscorlib, 版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089]]'。 仅支持原始类型或枚举类型 上下文。
【问题讨论】:
标签: c# entity-framework linq linq-to-entities entity-framework-6