コード例 #1
0
 private static IEnumerable <RouteInfo> GetRoutes(IServiceScopeFactory factory)
 {
     using (var scope = factory.CreateScope())
     {
         foreach (var controller in scope.ServiceProvider.GetServices <IController>())
         {
             var ctype = controller.GetType();
             foreach (var mi in ctype
                      .GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
                      .Where(x => x.ReturnType == typeof(ActionResult) || x.ReturnType.BaseType == typeof(ActionResult)))
             {
                 yield return(RouteInfo.Create(ctype, mi));
             }
         }
     }
 }
コード例 #2
0
ファイル: Route.cs プロジェクト: pfogolin/route-simulator
 public void ConnectTo(Route destination, int price)
 {
     RouteInfo.Create(price, this, destination);
 }