Esempio n. 1
0
        public static void AddNsb(this IServiceCollection services)
        {
            var licensePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NSB_License.xml");

            var config = new EndpointConfiguration("SignalRTest");

            if (File.Exists(licensePath))
            {
                config.LicensePath(licensePath);
            }

            config.UseTransport <LearningTransport>();

            config.RegisterComponents(
                configComp =>
            {
                configComp.ConfigureComponent(() =>
                                              GetHubContext(services),
                                              DependencyLifecycle.InstancePerCall);
            });

            var session = Endpoint.Start(config).Result;

            services.AddSingleton <IMessageSession>(session);
        }
Esempio n. 2
0
        public static EndpointConfiguration UseLicence(
            this EndpointConfiguration endpointConfiguration,
            Assembly assembly)
        {
            endpointConfiguration.LicensePath(assembly.Location.Replace(assembly.GetName().Name + ".dll", "License.xml"));

            return(endpointConfiguration);
        }