これは、asp.netWebAPIプロジェクト全体で多くのメソッドを管理する際の単純な問題です。
このような方法はかなりあります。
ProductsApiController.GetByType(string type, string x)
ProductsApiController.GetByType(string type, int limit)
//method has a number of arguments..
ReportsApiController.GetAll(string x, string y)
問題:カスタムパラメータを持つメソッドがたくさんあり、それぞれにカスタムルートを定義する必要があります
routes.MapRoute(
name: "ProductRoute",
url: "ProductsApiController/{type}/{x}"
);
routes.MapRoute(
name: "ReportRoute",
url: "ReportsApiController/{x}/{y}"
);
シグニチャを単純化しています。多くのパラメータを持つメソッドがたくさんあり、これらのメソッドには通常、共通のパラメータがありません。
これの一般的なパターンは何ですか?これを行うためのより良い方法はありますか、それとも私はこれだけを残していますか?