【发布时间】:2011-12-16 03:32:42
【问题描述】:
在 UpdateModel 中发现错误
“在实体反序列化期间,仅 .NET 3.5+ 支持设置 Id 属性” System.Exception {System.NotSupportedException}
public ActionResult Edit1(Guid id, ActivityResponseConsumerMobile arcm) {
if (!ModelState.IsValid) {
SetupDropDowns();
return View(arcm);
}
ActivityResponseConsumerMobile arcmDb = uow.ActivityResponseConsumerMobiles.Single(a => a.Id == id);
try {
UpdateModel(arcmDb);
}
catch {
var x = ModelState;
return View(arcm);
}
感觉像 SO 问题:MVC2 throws InvalidOperationException in UpdateModel(), trying to update the id field
但我使用的是对象而不是 FormCollection。我使用的 ORM 是 LightSpeed。
【问题讨论】: