Settings for the SQL Server scale-out message bus implementation.
Inheritance: Microsoft.AspNet.SignalR.Messaging.ScaleoutConfiguration
コード例 #1
0
        /// <summary>
        /// Use SQL Server as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="configuration">The SQL scale-out configuration options.</param>
        /// <returns>The dependency resolver.</returns>
        public static IDependencyResolver UseSqlServer(this IDependencyResolver resolver, SqlScaleoutConfiguration configuration)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            var bus = new Lazy<SqlMessageBus>(() => new SqlMessageBus(resolver, configuration));
            resolver.Register(typeof(IMessageBus), () => bus.Value);

            return resolver;
        }
コード例 #2
0
        /// <summary>
        /// Use SQL Server as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="configuration">The SQL scale-out configuration options.</param>
        /// <returns>The dependency resolver.</returns>
        public static IDependencyResolver UseSqlServer(this IDependencyResolver resolver, SqlScaleoutConfiguration configuration)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            // TODO: Can this be Lazy<T> initialized again now?
            var bus = new SqlMessageBus(resolver, configuration);
            resolver.Register(typeof(IMessageBus), () => bus);

            return resolver;
        }
コード例 #3
0
 public void Configuration(IAppBuilder app)
 {
     var connectionString = @"Data Source=(localdb)\v11.0;Initial Catalog=SignalRBroadcastDb;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False";              
     /* Example of connection string:
        @"server=.\SQLExpress;database=signalrscaleout;Trusted_Connection=yes";
     */
     var config = new SqlScaleoutConfiguration(connectionString)
                     {
                         TableCount = 5
                     };
     GlobalHost.DependencyResolver.UseSqlServer(config);
     app.MapSignalR();
 }
コード例 #4
0
        /// <summary>
        /// Use SQL Server as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="connectionString">The SQL Server connection string.</param>
        /// <returns>The dependency resolver.</returns>
        public static IDependencyResolver UseSqlServer(this IDependencyResolver resolver, string connectionString)
        {
            var config = new SqlScaleoutConfiguration(connectionString);

            return UseSqlServer(resolver, config);
        }
コード例 #5
0
        /// <summary>
        /// Use SQL Server as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="configuration">The SQL scale-out configuration options.</param>
        /// <returns>The dependency resolver.</returns>
        public static IDependencyResolver UseSqlServer(this IDependencyResolver resolver, SqlScaleoutConfiguration configuration)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            var bus = new Lazy <SqlMessageBus>(() => new SqlMessageBus(resolver, configuration));

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

            return(resolver);
        }
コード例 #6
0
        /// <summary>
        /// Use SQL Server as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="connectionString">The SQL Server connection string.</param>
        /// <returns>The dependency resolver.</returns>
        public static IDependencyResolver UseSqlServer(this IDependencyResolver resolver, string connectionString)
        {
            var config = new SqlScaleoutConfiguration(connectionString);

            return(UseSqlServer(resolver, config));
        }
コード例 #7
0
        /// <summary>
        /// Use SQL Server as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="configuration">The SQL scale-out configuration options.</param>
        /// <returns>The dependency resolver.</returns>
        public static IDependencyResolver UseSqlServer(this IDependencyResolver resolver, SqlScaleoutConfiguration configuration)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            // TODO: Can this be Lazy<T> initialized again now?
            var bus = new SqlMessageBus(resolver, configuration);

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

            return(resolver);
        }