ルーティング テーブルに次のエントリがあります。
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 を区別し、それぞれに対して異なる動作をするために、パラメーターの値が要求によって提供されない場合の標準的な動作ですか?