0
私はこれを簡潔かつ簡潔にしています。私はここに私のコントローラを持っEntity Frameworkを使用してモデルのバインドされたオブジェクトを保持する
... myCustomObjectは偉大に見える
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(CustomObject myCustomObject)
{
...
}
。しかし、私は、エンティティフレームワークを使用して、これを保存したい場合は、私はこのような何かをする必要があります...
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(CustomObject myCustomObject)
{
CustomObject existingObject = repository.GetCustomObject(myCustomObject.ID);
// Set all the attributes of myCustomObject to existingObject
existingObject.SomeMapperFunction(myCustomObject)
repository.Save();
}
は、私は、このマッピングexcersiseをやってから保つことができる方法はありますか?