public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseCors("CorsPolicy"); app.UseFailingMiddleware(); ConfigureAuth(app); app.UseMvcWithDefaultRoute(); app.UseSwagger() .UseSwaggerUi(); OrderingContextSeed.SeedAsync(app).Wait(); var integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(Configuration["ConnectionString"], b => b.MigrationsAssembly("Ordering.API")) .Options); integrationEventLogContext.Database.Migrate(); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { //Configure logs loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseCors("CorsPolicy"); ConfigureAuth(app); app.UseMvcWithDefaultRoute(); app.UseSwagger() .UseSwaggerUi(); var context = (DepartmentContext)app .ApplicationServices.GetService(typeof(DepartmentContext)); WaitForSqlAvailability(context, loggerFactory); //Seed Data DepartmentContextSeed.SeedAsync(app, loggerFactory).Wait(); var integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(Configuration["ConnectionString"], b => b.MigrationsAssembly("LodgerPms.Departments.Api")) .Options); integrationEventLogContext.Database.Migrate(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseCors("CorsPolicy"); app.UseMvcWithDefaultRoute(); app.UseSwagger() .UseSwaggerUi(); var context = (InventoryContext)app.ApplicationServices.GetService(typeof(InventoryContext)); WaitForSqlAvailability(context, loggerFactory); InventoryContextSeed.SeedAsync(app, loggerFactory) .Wait(); var integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(Configuration["ConnectionString"], b => b.MigrationsAssembly("InventoryAPI")) .Options); try { integrationEventLogContext.Database.Migrate(); } catch (Exception ex) { throw ex; } }
public IntegrationEventLogService(DbContextOptions <IntegrationEventLogContext> dbContextOptions) : this() { var options = dbContextOptions ?? throw new ArgumentNullException(nameof(dbContextOptions)); _integrationEventLogContext = new IntegrationEventLogContext(options); }
/// <summary> /// Constructs the service using the provided database connection. /// The database should always be the same as the one domain data is stored in to ease correlatability. /// See <c>IntegrationEventService</c> for how the database connection is provided. /// </summary> /// <param name="dbConnection">The database connection to use for logging events.</param> public IntegrationEventLogService(DbConnection dbConnection) { _dbConnection = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection)); _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseNpgsql(_dbConnection).UseSnakeCaseNamingConvention() .Options); }
public IntegrationEventLogService(DbConnection dbConnection) { var dbcontextOption = new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(dbConnection) .Options; _integrationEventLogContext = new IntegrationEventLogContext(dbcontextOption); }
public IntegrationEventLogService(string dbConnection) { _dbConnection = dbConnection; _eventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(_dbConnection).Options ); }
public ModuloIntegrationEventService(ModuloContext moduloContext, IntegrationEventLogContext logContext, IEventBus eventBus, IOptionsSnapshot <ModuloSettings> settings, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _moduloContext = moduloContext ?? throw new ArgumentNullException(nameof(moduloContext)); _logContext = logContext ?? throw new ArgumentNullException(nameof(logContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_moduloContext.Database.GetDbConnection()); }
public IntegrationEventLogService(DbConnection connection) { var conn = connection ?? throw new ArgumentNullException(nameof(connection)); _context = new IntegrationEventLogContext(new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(conn).Options); _eventTypes = Assembly.Load(Assembly.GetEntryAssembly().FullName).GetTypes() .Where(x => x.Name.EndsWith(nameof(IntegrationEvent))).ToList(); }
public IntegrationEventLogService(DbConnection dbConnection) { _dbConnection = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection)); _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(_dbConnection) .ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)) .Options); }
public OrderingIntegrationEventService(IntegrationEventLogContext context, IEventBus eventBus, ILogger <OrderingIntegrationEventService> logger) { this._context = context; this._eventBus = eventBus; this._logger = logger; _logger.LogInformation(" [x] Creating an instance of OrderingIntegrationEventService."); }
public CustomerIntegrationEventService( IEventBus eventBus, FructoseContext fructoseContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _eventBus = eventBus; _fructoseContext = fructoseContext; _eventLogService = integrationEventLogServiceFactory(fructoseContext.Database.GetDbConnection()); }
public MySqlEventStore( IdentityAccessDbContext context ) { _context = context ?? throw new ArgumentNullException(nameof(context)); _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseMySql(_context.Database.GetDbConnection()) .ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)) .Options); }
public SigmaIntegrationEventService(IEventBus eventBus, SigmaContext sigmaContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _sigmaContext = sigmaContext ?? throw new ArgumentNullException(nameof(sigmaContext)); _eventLogContext = eventLogContext ?? throw new ArgumentNullException(nameof(eventLogContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_sigmaContext.Database.GetDbConnection()); }
public AttachmentIntegrationEventService(IEventBus eventBus, AttachmentContext attachmentContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _attachmentContext = attachmentContext ?? throw new ArgumentNullException(nameof(attachmentContext)); _eventLogContext = eventLogContext ?? throw new ArgumentNullException(nameof(eventLogContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_attachmentContext.Database.GetDbConnection()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); ConfigureSwagger(app); } /* app.UseExceptionHandler(options => { * * options.Run( * async context => * { * context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; * context.Response.ContentType = "text/html"; * var ex = context.Features.Get<IExceptionHandlerFeature>(); * if (ex != null) * { * var err = $"<h1>Error: {ex.Error.Message}</h1>{ex.Error.StackTrace }"; * await context.Response.WriteAsync(err).ConfigureAwait(false); * } * }); * });*/ app.UseExceptionHandler(o => o.UseExceptionHandlerMiddleware()); //app.UseSampleMiddleware(); /*app.UseStatusCodePages(async context => * { * context.HttpContext.Response.ContentType = "text/plain"; * * await context.HttpContext.Response.WriteAsync( * "Status code page, status code: " + * context.HttpContext.Response.StatusCode); * });*/ app.UseMvcWithDefaultRoute(); WaitForSqlAvailabilityAsync(loggerFactory, app, env).Wait(); var integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(Configuration["ConnectionString"], b => b.MigrationsAssembly("Sample.Api")) .Options); integrationEventLogContext.Database.Migrate(); //ConfigureEventBus(app); }
public BookingIntegrationEventService(IEventBus eventBus, BookingDbContext bookingContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _bookingContext = bookingContext ?? throw new ArgumentNullException(nameof(bookingContext)); _eventLogContext = eventLogContext ?? throw new ArgumentNullException(nameof(eventLogContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_bookingContext.Database.GetDbConnection()); }
public EmployeeIntegrationEventService(IEventBus eventBus, EmployeeContext EmployeeContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory, ILogger <EmployeeIntegrationEventService> logger) { _EmployeeContext = EmployeeContext ?? throw new ArgumentNullException(nameof(EmployeeContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_EmployeeContext.Database.GetDbConnection()); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public OrderingIntegrationEventService(IEventBus eventBus, OrderingContext orderingContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory, ILogger <OrderingIntegrationEventService> logger) { _orderingContext = orderingContext ?? throw new ArgumentNullException(nameof(orderingContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_orderingContext.Database.GetDbConnection()); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public IntegrationEventLogService(DbConnection dbConnection) { _dbConnection = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection)); _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>().UseNpgsql(_dbConnection).Options ); _eventTypes = Assembly.Load(Assembly.GetEntryAssembly().FullName) .GetTypes() .Where(t => t.Name.EndsWith(nameof(IntegrationEvent))) .ToList(); }
public IntegrationContextEventService( ProductsApplicationContext dbContext, IIntegrationEventLogService integrationEventLogService, IEventBus eventBus, IntegrationEventLogContext integrationEventLogContext ) { _dbContext = dbContext; _integrationEventLogService = integrationEventLogService; _eventBus = eventBus; _integrationEventLogContext = integrationEventLogContext; }
public POSServiceIntegrationEventService(IEventBus eventBus, POSContext posContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory, ILogger <POSServiceIntegrationEventService> logger, IntegrationEventLogContext integrationContext) { _posContext = posContext ?? throw new ArgumentNullException(nameof(posContext)); _integrationContext = integrationContext ?? throw new ArgumentNullException(nameof(integrationContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_integrationContext.Database.GetDbConnection()); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public IntegrationEventLogService(DbConnection dbConnection) { _dbConnection = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection)); _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(_dbConnection) .ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)) .Options); _eventTypes = Assembly.Load(Assembly.GetEntryAssembly().FullName) .GetTypes() .Where(t => t.Name.EndsWith(nameof(IntegrationEvent))) .ToList(); }
public IntegrationEventLogService(DbConnection dbConnection) { _dbConnection = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection)); _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseSqlServer(_dbConnection) .Options); //Get all Integration Events in parent domains that references this project like (order.api & catalog.api) _eventTypes = Assembly.Load(Assembly.GetEntryAssembly().FullName) .GetTypes() .Where(t => t.Name.EndsWith(nameof(IntegrationEvent))) .ToList(); }
public IntegrationEventLogService(IConfiguration configuration) { this.Configuration = configuration; _integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder <IntegrationEventLogContext>() .UseMySql(Configuration.GetConnectionString("MySqlConnection")) .ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)) .Options); _eventTypes = Assembly.Load(Assembly.GetEntryAssembly().FullName) .GetTypes() .Where(t => t.Name.EndsWith(nameof(IntegrationEvent))) .ToList(); }
/* * Reuse existing database connection from main application context * instead of creating new context specifically for integration event log */ public IntegrationEventLogRepository(DbConnection dbConnection) { if (dbConnection == null) { throw new ArgumentNullException(nameof(dbConnection)); } _eventTypes = Assembly.Load(Assembly.GetEntryAssembly().FullName) .GetTypes() .Where(t => t.Name.EndsWith(nameof(IntegrationEvent))) .ToList(); _context = new IntegrationEventLogContext(new DbContextOptionsBuilder <IntegrationEventLogContext>().UseSqlServer(dbConnection).Options); }
public DeliveryIntegrationEventService(IEventBus eventBus, DeliveryContext deliveryContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory, ILogger <DeliveryIntegrationEventService> logger) { _deliveryContext = deliveryContext ?? throw new ArgumentNullException(nameof(deliveryContext)); var integrationEventLogServiceFactory1 = integrationEventLogServiceFactory ?? throw new ArgumentNullException( nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = integrationEventLogServiceFactory1(_deliveryContext.Database.GetDbConnection()); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }