現在のプロジェクトで t4mvc を使用しており、含まれているルーティング ヘルパーを使用しようとしていますが、以下のようにカスタム制約を使用しようとすると
routes.MapRoute(
"def_filtered_reports_route",
"reports/{samplePoint}/{fromDate}/{toDate}",
MVC.Report.Results(null, null, null),
new
{
samplePoint = new SamplePointExistsConstraint(),
fromDate = new DateTimeConstraint(),
toDate = new DateTimeConstraint()
}
);
それは状態をスローしArgumentException
ますAn item with the same key has already been added.
このように書いたら
routes.MapRoute(
"def_filtered_reports_route",
"reports/{samplePoint}/{fromDate}/{toDate}",
MVC.Report.Results(null, null, null) );
またはこのように
routes.MapRoute(
"def_filtered_reports_route",
"reports/{samplePoint}/{fromDate}/{toDate}",
new
{
controller = "Report",
action = "Results",
fromDate = "",
toDate = "",
samplePoint = ""
},
new
{
fromDate = new DateTimeConstraint(),
toDate = new DateTimeConstraint(),
samplePoint = new SamplePointExistsConstraint()
});
それは正常に動作します。
不足しているものはありますか、それとも t4mvc はカスタム制約をサポートしていませんか?