ルーティング テーブルに次のエントリがあります。
routes.MapRoute(null,
"instructions/new",
new { controller = "Instructions", action = "NewInstructions" },
new { httpMethod = new HttpMethodConstraint("GET") }
);
この方法
[HttpGet]
public ActionResult NewInstructions(Client client)
{
var instructions = instructionService.Create(client);
return RedirectToAction("Instructions", new { id = instructions.Id });
}
メソッドへのこのリンク
<a href="/instructions/new">create a new one</a>
この場合、client
アクション メソッドが呼び出されたときに、パラメーターは null ではありません。Client
代わりに、のパラメーターなしのコンストラクターを呼び出すことによって作成されるようです。
ただし、同じアクション メソッドを POST 経由でアクセスできるようにすると、client
パラメーターは正しく に設定されnull
ます。
DefaultModelBinder
これは、GET と POST を区別し、それぞれに対して異なる動作をするために、パラメーターの値が要求によって提供されない場合の標準的な動作ですか?