コード例 #1
0
 private static void MapHubForDynamicType(this HubRouteBuilder builder, string route, Type type)
 {
     typeof(HubRouteBuilder)
     .GetMethod(nameof(HubRouteBuilder.MapHub), new Type[] { typeof(PathString) })
     .MakeGenericMethod(type)
     .Invoke(builder, new Object[] { (PathString)route });
 }
コード例 #2
0
ファイル: Startup.cs プロジェクト: sweepglass/MachinaTrader
        public static HubRouteBuilder MapSignalrRoutes(this HubRouteBuilder hubRouteBuilder)
        {
            IEnumerable <Assembly> assembliesPlugins = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory, "MachinaTrader.Plugin.*.dll", SearchOption.TopDirectoryOnly)
                                                       .Select(Assembly.LoadFrom);

            foreach (var assembly in assembliesPlugins)
            {
                IEnumerable <Type> pluginHubTypes = assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Hub)) && !t.IsAbstract);

                foreach (var pluginHubType in pluginHubTypes)
                {
                    //Console.WriteLine("Assembly Name: " + assembly.GetName().Name);
                    //Console.WriteLine("HubName: " + pluginHubType);
                    string hubRoute = pluginHubType.ToString().Replace(assembly.GetName().Name, "").Replace(".Hubs.", "").Replace("MachinaTrader", "");
                    Global.Logger.Information(assembly.GetName().Name + " - Hub Route " + hubRoute);
                    MapHubMethod.MakeGenericMethod(pluginHubType).Invoke(hubRouteBuilder, new object[] { new PathString("/signalr/" + hubRoute) });
                }
            }
            //Add Global Hubs -> No plugin
            hubRouteBuilder.MapHub <HubMainIndex>("/signalr/HubMainIndex");
            hubRouteBuilder.MapHub <HubTraders>("/signalr/HubTraders");
            hubRouteBuilder.MapHub <HubStatistics>("/signalr/HubStatistics");
            hubRouteBuilder.MapHub <HubBacktest>("/signalr/HubBacktest");
            hubRouteBuilder.MapHub <HubExchangeAccounts>("/signalr/HubExchangeAccounts");
            //Hub Log is located in Globals because we need to wire up with serilog
            hubRouteBuilder.MapHub <HubLogs>("/signalr/HubLogs");
            return(hubRouteBuilder);
        }
コード例 #3
0
 public void MapHubs(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     foreach (var map in Maps)
     {
         map.MapHub(routes, signalRUrlPrefix);
     }
 }
コード例 #4
0
        public static void CallMapHub(this HubRouteBuilder hubRouteBuilder, Type hubClassType, PathString pathString,
                                      Action <HttpConnectionDispatcherOptions> configureOptions = null)
        {
            Action <PathString, Action <HttpConnectionDispatcherOptions> > action = hubRouteBuilder.MapHub <Hub>;

            var mapHubMethodInfo = action.Method.GetGenericMethodDefinition().MakeGenericMethod(hubClassType);

            mapHubMethodInfo.Invoke(hubRouteBuilder, new object[] { pathString, configureOptions });
        }
コード例 #5
0
        /// <summary>
        /// Maps Aika SignalR routes.
        /// </summary>
        /// <param name="hubRouteBuilder">The <see cref="HubRouteBuilder"/> to register the SignalR routes with.</param>
        /// <returns>
        /// The same <paramref name="hubRouteBuilder"/>, to allow method chaining.
        /// </returns>
        public static HubRouteBuilder MapAikaHubs(this HubRouteBuilder hubRouteBuilder)
        {
            if (hubRouteBuilder == null)
            {
                throw new ArgumentNullException(nameof(hubRouteBuilder));
            }

            hubRouteBuilder.MapHub <Hubs.SnapshotHub>("aika/hubs/snapshot");
            hubRouteBuilder.MapHub <Hubs.DataFilterHub>("aika/hubs/datafilter");

            return(hubRouteBuilder);
        }
コード例 #6
0
 public static void MapTankaServerHub(
     this HubRouteBuilder routes,
     PathString route,
     Action <HttpConnectionDispatcherOptions> configureOptions = null)
 {
     if (configureOptions != null)
     {
         routes.MapHub <ServerHub>(route, configureOptions);
     }
     else
     {
         routes.MapHub <ServerHub>(route);
     }
 }
コード例 #7
0
 public static void MapHubs(this HubRouteBuilder builder, params Assembly[] assemblies)
 {
     if (null != builder && null != assemblies)
     {
         foreach (Assembly assembly in assemblies)
         {
             if (null != assembly)
             {
                 foreach (Type type in assembly.GetTypes())
                 {
                     if (!type.IsAbstract && HubType.IsAssignableFrom(type))
                     {
                         MethodInfo generic = HubRouteBuilderMapHubMethod.MakeGenericMethod(type);
                         generic.Invoke(builder, new object[] { new PathString("/hubs/" + type.Name.ToLower(UsCultureInfo).Replace("hub", "")) });
                     }
                 }
             }
         }
     }
 }
コード例 #8
0
 public void MapHub(HubRouteBuilder routes, string hubPathPrefix)
 {
     routes.MapHub <ApiNotificationHub <AuthorDto> >(hubPathPrefix + "/blog/authors/notifications");
 }
コード例 #9
0
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <FlightSearchHub>(signalRUrlPrefix + "/signalr/flight-search");
 }
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <MailingListDto> >(signalRUrlPrefix + "/cms/mailing-list/notifications");
 }
コード例 #11
0
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <FaqDto> >(signalRUrlPrefix + "/cms/faqs/notifications");
 }
コード例 #12
0
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <ContentTextDto> >(signalRUrlPrefix + "/cms/content-texts/notifications");
 }
コード例 #13
0
 public static HubRouteBuilder MapDotNetifyHub(this HubRouteBuilder routes)
 {
     routes.MapHub <DotNetifyHub>("dotnetify");
     return(routes);
 }
コード例 #14
0
 public static HubRouteBuilder MapDotNetifyHub(this HubRouteBuilder routes)
 {
     routes.MapHub <DotNetifyHub>(HUB_PATH);
     return(routes);
 }
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <CarouselItemDto> >(signalRUrlPrefix + "/cms/carousel-items/notifications");
 }
コード例 #16
0
ファイル: NewStartup.cs プロジェクト: whizkidwwe1217/GoldRush
 protected virtual void ConfigureSignalRHubs(HubRouteBuilder routes)
 {
 }
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <FormDto> >(signalRUrlPrefix + "/forms/form-section-submissions/notifications");
 }
コード例 #18
0
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <LookupTableDto> >(signalRUrlPrefix + "/forms/lookup-tables/notifications");
 }
コード例 #19
0
 public static void MapQueryHub(this HubRouteBuilder routes, string path = "/hubs/query") =>
 routes.MapHub <QueryHub>(path);
コード例 #20
0
 public static void MapQueryHub(this HubRouteBuilder routes, Action <HttpConnectionDispatcherOptions> configure, string path = "/hubs/query") =>
 routes.MapHub <QueryHub>(path, configure);
コード例 #21
0
ファイル: WebApiBootstrapper.cs プロジェクト: benwasd/ssah
 public static void ConfigureSignalRUsage(HubRouteBuilder routeBuilder)
 {
     routeBuilder.MapHub <CourseChangeHub>("/courseChange");
 }
コード例 #22
0
 private void ConfigureHubRouteBuilder(HubRouteBuilder hubRouteBuilder)
 {
     hubRouteBuilder.MapHub <SignalRHub>("/enigma-signalr-hub");
 }
コード例 #23
0
ファイル: ConfigureWebApp.cs プロジェクト: jmptrader/BlazorUI
 internal void ConfigureSignalRRoutes(HubRouteBuilder signalRRoutes) =>
 _signalRRoutes?.Invoke(signalRRoutes);
コード例 #24
0
 public static void MapHubs(this HubRouteBuilder routeBuilder)
 {
     routeBuilder.MapHub <AuthenticationNotificationHub>(SignalREndpoints.AuthenticationNotificationHubName);
 }
コード例 #25
0
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <BlogPostDto> >(signalRUrlPrefix + "/blog/blog-posts/notifications");
 }
コード例 #26
0
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <QuestionDto> >(signalRUrlPrefix + "/forms/questions/notifications");
 }
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <TestimonialDto> >(signalRUrlPrefix + "/cms/testimonials/notifications");
 }
コード例 #28
0
 public static HubRouteBuilder MapDotNetifyHub(this HubRouteBuilder routes, Action <HttpConnectionDispatcherOptions> options)
 {
     routes.MapHub <DotNetifyHub>(HUB_PATH, options);
     return(routes);
 }
コード例 #29
0
 public static void Register(HubRouteBuilder route)
 {
     route.MapHub <PaymentRequestHub>("/payment-requests/hub");
 }
コード例 #30
0
 public void MapHub(HubRouteBuilder routes, string signalRUrlPrefix)
 {
     routes.MapHub <ApiNotificationHub <TagDto> >(signalRUrlPrefix + "/blog/tags/notifications");
 }