私たちの MVC3 ルーティング エンジンには、評価するデータベース ルックアップを含む制約を持ついくつかのエントリがあります。例えば:
routes.MapRoute(
"Product",
"{manufacturer}/{partNumber}",
new { controller = "Product", action = "Details", manufacturer = "" },
new { manufacturer = new ManufacturerConstraint() }
);
routes.MapRoute(
"Store",
"{store}/{action}",
new { controller = "Store", action = "Index" },
new { store = new StoreConstraint() }
);
whereManufacturererConstraint()
にはデータベース ルックアップが含まれますが、含まれStoreConstraint()
ません。
RouteUrl
次のようなリンクを生成するために使用しています。
RouteUrl("Product", new { manufacturer = product.Brand, partNumber = product.PartNumber });
これからの3つの質問:
- 私たちの使用はデータベース検索を引き起こしますか?
- 「ストア」ルートのルートを生成した場合、すべてのルートに対してテストするため、ルックアップも生成されますか? それとも、指定されたルートに対して 1 つのテストのみを実行しますか?
- この使用法でデータベースにヒットした場合、そうでない使用方法はあり
RouteUrl
ますか?