型号: -
public partial class tblMake
{
[Key]
[Column(Order = 0)]
[StringLength(10)]
[Display(Name = "Company Code")]
public string Company_Code { get; set; }
[Key]
[Column(Order = 1)]
[StringLength(20)]
[Display(Name = "Make Code")]
public string Make_Code { get; set; }
[StringLength(60)]
[Display(Name = "Description")]
public string Description { get; set; }
[StringLength(255)]
[Display(Name = "Remark")]
public string Remark { get; set; }
}
查看: -
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.Company_Code)
<div class="form-group">
<label for="text" style="float: left; width: 200px; ">Make Code :</label>
<div class="input-group">
@Html.TextBoxFor(model => model.Make_Code, new { style = "width:200px" })
@Html.ValidationMessageFor(model => model.Make_Code)
</div>
</div>
<div class="form-group">
<label for="text" style="float: left; width: 200px; ">Description :</label>
<div class="input-group">
@Html.TextBoxFor(model => model.Description, new { style = "width:600px" })
@Html.ValidationMessageFor(model => model.Description)
</div>
</div>
<div class="form-group">
<label for="text" style="float: left; width: 200px; ">Remark :</label>
<div class="input-group">
@Html.TextAreaFor(model => model.Remark, new { style = "width:800px;height: 150px;" })
@Html.ValidationMessageFor(model => model.Remark)
</div>
</div>
当我尝试编辑'Make Code';这是复合主键的一部分时,它带有错误(插入换行符以便于阅读): -
System.Data.Entity.Core.OptimisticConcurrencyException:
Store update, insert, or delete statement affected an unexpected number of rows (0).
Entities may have been modified or deleted since entities were loaded.
Refresh ObjectStateManager entries.
任何人都可以解释该做什么吗?