示例#1
0
        public void Customize(BusConfiguration configuration)
        {
            // NServiceBus provides the following durable storage options
            // To use RavenDB, install-package NServiceBus.RavenDB and then use configuration.UsePersistence<RavenDBPersistence>();
            // To use SQLServer, install-package NServiceBus.NHibernate and then use configuration.UsePersistence<NHibernatePersistence>();

            // If you don't need a durable storage you can also use, configuration.UsePersistence<InMemoryPersistence>();
            // more details on persistence can be found here: http://docs.particular.net/nservicebus/persistence-in-nservicebus

            //Also note that you can mix and match storages to fit you specific needs.
            //http://docs.particular.net/nservicebus/persistence-order
            configuration.UsePersistence <InMemoryPersistence>();
            configuration.DisableFeature <SecondLevelRetries>();

            ConfigureLogging.NLog();

            configuration.DefineMessageConventions();
        }
示例#2
0
        /// <summary>
        /// Register services in the DI container.
        /// </summary>
        /// <param name="services">The services collection.</param>
        /// <returns>The updated services collection.</returns>
        public static IServiceCollection RegisterInfrastructureServices(this IServiceCollection services)
        {
            // Context Providers
            services.AddSingleton <IHealthCheck, WebSiteHealthCheck>();
            services.AddScoped <ILogEventEnricher, LoggingEnricher>();

            // we need to add this long hand so resolve some bits first
            var provider    = services.BuildServiceProvider();
            var logOptions  = provider.GetRequiredService <IOptions <SerilogOptions> >();
            var hosting     = provider.GetRequiredService <IHostingEnvironment>();
            var logEnricher = provider.GetRequiredService <ILogEventEnricher>();

            // create a new instance and register
            var configureLogging = new ConfigureLogging(hosting, logOptions, logEnricher);

            services.AddSingleton <IConfigureLogging>(configureLogging);

            // now configure
            configureLogging.Configure();

            return(services);
        }
示例#3
0
 public void Then_LogToCategoryNamed_ThrowsArgumentException()
 {
     ConfigureLogging.LogToCategoryNamed(null);
 }
示例#4
0
        protected override void Arrange()
        {
            base.Arrange();

            CategorySourceBuilder = ConfigureLogging.LogToCategoryNamed(categoryName);
        }