Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SignalRMessageBus"/> class.
        /// </summary>
        /// <param name="resolver">The resolver to use.</param>
        /// <param name="configuration">The SignalR scale-out configuration options.</param>
        public SignalRMessageBus(IDependencyResolver resolver, SignalRScaleoutConfiguration configuration)
            : base(resolver, configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            var traceManager = resolver.Resolve <ITraceManager>();

            _trace = traceManager[GetType().Name];

            _hubConnection             = new HubConnection(configuration.ConnectionString);
            _hubConnection.Credentials = CredentialCache.DefaultNetworkCredentials;
            _hubProxy = _hubConnection.CreateHubProxy(BackplaneConstants.SdlBackplaneHub);

            Initialize();
        }
        public static IDependencyResolver UseSdlBackplane(this IDependencyResolver resolver, string connectionString)
        {
            SignalRScaleoutConfiguration config = new SignalRScaleoutConfiguration(connectionString);

            return(UseSdlBackplane(resolver, config));
        }
        public static IDependencyResolver UseSdlBackplane(this IDependencyResolver resolver, SignalRScaleoutConfiguration configuration)
        {
            SignalRMessageBus bus = new SignalRMessageBus(resolver, configuration);

            resolver.Register(typeof(IMessageBus), () => bus);
            return(resolver);
        }