当前位置: 首页>>代码示例>>C#>>正文


C# Configure类代码示例

本文整理汇总了C#中Configure的典型用法代码示例。如果您正苦于以下问题:C# Configure类的具体用法?C# Configure怎么用?C# Configure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Configure类属于命名空间,在下文中一共展示了Configure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        /// <summary>
        /// The run method
        /// </summary>
        /// <param name="config">
        /// The config.
        /// </param>
        public void Run(Configure config)
        {
            Logger.Info("Statup.Run()");

            var initMessage = new MyMessage
                                  {
                                      SomeId = "carlos",
                                      LargeBlob = new DataBusProperty<byte[]>(Guid.NewGuid().ToByteArray())
                                  };
            var anotherMessage = new AnotherSagaCommand { SomeId = initMessage.SomeId, SleepHowLong = 2000 };

            Thread.Sleep(5000);
            this.bus.Send(initMessage);

            Thread.Sleep(1000);

            for (var i = 0; i < 5; i++)
            {
                anotherMessage.SleepHowLong = i;
                this.bus.SendLocal(anotherMessage);
            }

            anotherMessage.SleepHowLong = 0;
            this.bus.SendLocal(anotherMessage);
            this.bus.SendLocal(anotherMessage);
            this.bus.SendLocal(anotherMessage);
        }
开发者ID:freemsly,项目名称:NServiceBus.MongoDB,代码行数:33,代码来源:Startup.cs

示例2: Install

        public void Install(string identity, Configure config)
        {
            if (config.Settings.Get<bool>("Endpoint.SendOnly"))
            {
                return;
            }

            if (!config.CreateQueues())
            {
                return;
            }

            var wantQueueCreatedInstances = config.Builder.BuildAll<IWantQueueCreated>().ToList();

            foreach (var wantQueueCreatedInstance in wantQueueCreatedInstances.Where(wantQueueCreatedInstance => wantQueueCreatedInstance.ShouldCreateQueue()))
            {
                if (wantQueueCreatedInstance.Address == null)
                {
                    throw new InvalidOperationException(string.Format("IWantQueueCreated implementation {0} returned a null address", wantQueueCreatedInstance.GetType().FullName));
                }

                QueueCreator.CreateQueueIfNecessary(wantQueueCreatedInstance.Address, identity);
                Logger.DebugFormat("Verified that the queue: [{0}] existed", wantQueueCreatedInstance.Address);
            }
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:25,代码来源:QueuesCreator.cs

示例3: ToBrokeredMessage

        public static BrokeredMessage ToBrokeredMessage(this TransportMessage message, SendOptions options, SettingsHolder settings, bool expectDelay, Configure config)
        {
            var brokeredMessage = BrokeredMessageBodyConversion.InjectBody(message.Body);

            SetHeaders(message, options, settings, config, brokeredMessage);

            var timeToSend = DelayIfNeeded(options, expectDelay);
                        
            if (timeToSend.HasValue)
                brokeredMessage.ScheduledEnqueueTimeUtc = timeToSend.Value;

            TimeSpan? timeToLive = null;
            if (message.TimeToBeReceived < TimeSpan.MaxValue)
            {
                timeToLive = message.TimeToBeReceived;
            }
            else if (options.TimeToBeReceived.HasValue && options.TimeToBeReceived < TimeSpan.MaxValue)
            {
                timeToLive = options.TimeToBeReceived.Value;
            }

            if (timeToLive.HasValue)
            {
                if (timeToLive.Value <= TimeSpan.Zero) return null;

                brokeredMessage.TimeToLive = timeToLive.Value;
            }
            GuardMessageSize(brokeredMessage);

            return brokeredMessage;
        }
开发者ID:danielmarbach,项目名称:NServiceBus.AzureServiceBus,代码行数:31,代码来源:BrokeredMessageConverter.cs

示例4: ConfigurePublishingInfrastructure

 private void ConfigurePublishingInfrastructure(Configure config, AzureServiceBusQueueConfig configSection)
 {
     config.Configurer.ConfigureComponent<AzureServiceBusTopicPublisher>(DependencyLifecycle.InstancePerCall);
     config.Configurer.ConfigureProperty<AzureServiceBusTopicPublisher>(t => t.MaxDeliveryCount, configSection.MaxDeliveryCount);
     
     config.Configurer.ConfigureComponent<AzureServiceBusTopicSubscriptionManager>(DependencyLifecycle.InstancePerCall);
 }
开发者ID:Erwinvandervalk,项目名称:NServiceBus.Azure,代码行数:7,代码来源:ContainerConfiguration.cs

示例5: SetUp

 public void SetUp()
 {
     config = Configure.With(new[] { typeof(MySaga).Assembly})
         .DefaultBuilder()
         .Sagas()
         .NHibernateSagaPersister();
 }
开发者ID:togakangaroo,项目名称:NServiceBus,代码行数:7,代码来源:When_configuring_the_saga_persister_from_appconfig.cs

示例6: EnablingSla

 void EnablingSla(Configure configure)
 {
     #region enable-sla
     // in this version there was no granular control over individual counters
     configure.EnablePerformanceCounters();
     #endregion
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:7,代码来源:PerformanceMonitoring.cs

示例7: EnablingCriticalTime

 void EnablingCriticalTime(Configure configure)
 {
     #region enable-criticaltime
     // in this version there was no granular control over individual counters
     configure.EnablePerformanceCounters();
     #endregion
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:7,代码来源:PerformanceMonitoring.cs

示例8: RenamePrincipalHack

 void RenamePrincipalHack(Configure configure)
 {
     #region 3to4RenamePrincipalHack
     var unicastBus = configure.UnicastBus();
     unicastBus.RunHandlersUnderIncomingPrincipal(true);
     #endregion
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:7,代码来源:Upgrade.cs

示例9: Initialize

        protected override void Initialize(Configure config)
        {
            connectionStringFunc = () => "Url = http://localhost:8080; DefaultDatabase=MyDB";
            database = "CustomDatabase";

            config.RavenPersistence(connectionStringFunc, database);
        }
开发者ID:89sos98,项目名称:NServiceBus,代码行数:7,代码来源:When_configuring_persistence_to_use_a_raven_server_instance_using_a_connection_string_lambda_and_database.cs

示例10: Configure

        /// <summary>
        /// Wraps the given configuration object but stores the same 
        /// builder and configurer properties.
        /// </summary>
        /// <param name="config"></param>
        public void Configure(Configure config)
        {
            Builder = config.Builder;
            Configurer = config.Configurer;

            transportConfig = Configurer.ConfigureComponent<XmsTransport>(ComponentCallModelEnum.Singleton);

            var cfg = GetConfigSection<XmsTransportConfig>();

            var dictionary = new Dictionary<string, string>();
            if (cfg != null)
            {
                transportConfig.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
                transportConfig.ConfigureProperty(t => t.NumberOfWorkerThreads, cfg.NumberOfWorkerThreads);
                transportConfig.ConfigureProperty(t => t.ErrorQueue, cfg.ErrorQueue);
                transportConfig.ConfigureProperty(t => t.MaxRetries, cfg.MaxRetries);

                if(cfg.Aliases!=null)
                {
                    dictionary = cfg.Aliases.ToDictionary(x => x.Name, y => y.Value);
                }
            }

            transportConfig.ConfigureProperty(t => t.Aliases, dictionary);

            var unicastConfig = GetConfigSection<UnicastBusConfig>();

            if (unicastConfig != null)
            {
                if (!string.IsNullOrEmpty(unicastConfig.ForwardReceivedMessagesTo))
                    transportConfig.ConfigureProperty(t => t.ForwardReceivedMessagesTo, unicastConfig.ForwardReceivedMessagesTo);
            }
        }
开发者ID:sasha-uk,项目名称:NServiceBus.Xms.2,代码行数:38,代码来源:XmsTransportConfigure.cs

示例11: CustomRavenConfig

        CustomRavenConfig(Configure configure)
        {
            #region OldRavenDBPersistenceInitialization

            configure.RavenPersistence();
            configure.RavenSagaPersister();
            configure.RavenSubscriptionStorage();
            configure.UseRavenTimeoutPersister();
            configure.UseRavenGatewayDeduplication();
            configure.UseRavenGatewayPersister();

            #endregion

            #region Version2_5RavenDBPersistenceInitialization

            // Need to call this method
            configure.RavenDBStorage();
            // Call this method to use Raven saga storage
            configure.UseRavenDBSagaStorage();
            // Call this method to use Raven subscription storage
            configure.UseRavenDBSubscriptionStorage();
            // Call this method to use Raven timeout storage
            configure.UseRavenDBTimeoutStorage();
            // Call this method to use Raven deduplication storage for the Gateway
            configure.UseRavenDBGatewayDeduplicationStorage();
            // Call this method to use the  Raven Gateway storage method
            configure.UseRavenDBGatewayStorage();

            #endregion
        }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:30,代码来源:CustomRavenConfig.cs

示例12: Install

        public void Install(string identity, Configure config)
        {
            Console.Title = "Complaint.Frontend";

            Console.WriteLine(
                "Hy there from CustomWindowsEverytimeInstaller! I will run every time! Identity {0}", identity);
        }
开发者ID:gaimeng,项目名称:nservicebus.introduction,代码行数:7,代码来源:Installers.cs

示例13: Configure

        public void Configure(Configure config)
        {
            this.Builder = config.Builder;
            this.Configurer = config.Configurer;

            this.config = Configurer.ConfigureComponent<RabbitMqTransport>(ComponentCallModelEnum.Singleton);
            var cfg = NServiceBus.Configure.GetConfigSection<RabbitMqTransportConfig>();

            if(cfg != null)
            {
                this.config.ConfigureProperty(t => t.NumberOfWorkerThreads, cfg.NumberOfWorkerThreads);
                this.config.ConfigureProperty(t => t.MaximumNumberOfRetries, cfg.MaxRetries);
                this.config.ConfigureProperty(t => t.InputBroker, cfg.InputBroker);
                this.config.ConfigureProperty(t => t.InputExchange, cfg.InputExchange);
                this.config.ConfigureProperty(t => t.InputExchangeType, cfg.InputExchangeType);
                this.config.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
                this.config.ConfigureProperty(t => t.InputRoutingKeys, cfg.InputRoutingKeys);
                this.config.ConfigureProperty(t => t.DoNotCreateInputExchange, cfg.DoNotCreateInputExchange);
                this.config.ConfigureProperty(t => t.DoNotCreateInputQueue, cfg.DoNotCreateInputQueue);
                this.config.ConfigureProperty(t => t.ErrorBroker, cfg.ErrorBroker);
                this.config.ConfigureProperty(t => t.ErrorExchange, cfg.ErrorExchange);
                this.config.ConfigureProperty(t => t.ErrorExchangeType, cfg.ErrorExchangeType);
                this.config.ConfigureProperty(t => t.ErrorQueue, cfg.ErrorQueue);
                this.config.ConfigureProperty(t => t.ErrorRoutingKeys, cfg.ErrorRoutingKeys);
                this.config.ConfigureProperty(t => t.DoNotCreateErrorExchange, cfg.DoNotCreateErrorExchange);
                this.config.ConfigureProperty(t => t.DoNotCreateErrorQueue, cfg.DoNotCreateErrorQueue);

                this.config.ConfigureProperty(t => t.TransactionTimeout, TimeSpan.FromMinutes(cfg.TransactionTimeout));
                this.config.ConfigureProperty(t => t.SendAcknowledgement, cfg.SendAcknowledgement);
            }
        }
开发者ID:jonocairns,项目名称:nservicebusrabbitmq,代码行数:31,代码来源:ConfigureRabbitMq.cs

示例14: SqsDequeueStrategy

        public SqsDequeueStrategy(Configure config)
        {
			if (config != null)
				_purgeOnStartup = config.PurgeOnStartup();
			else
				_purgeOnStartup = false;
        }
开发者ID:GCMGrosvenor,项目名称:NServiceBus.AmazonSQS-1,代码行数:7,代码来源:SqsDequeueStrategy.cs

示例15: SetUp

        public void SetUp()
        {
            config = Configure.With()
          .SpringBuilder()
          .DBSubcriptionStorage();

        }
开发者ID:vimaire,项目名称:NServiceBus_2.0,代码行数:7,代码来源:When_configuring_the_subscription_storage.cs


注:本文中的Configure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。