public IdempotentMessageConsumer(ZaminConfigurationOptions zaminConfigurations, IEventDispatcher eventDispatcher, IJsonSerializer jsonSerializer, ICommandDispatcher commandDispatcher, IMessageInboxItemRepository messageInboxItemRepository) { _zaminConfigurations = zaminConfigurations; _eventDispatcher = eventDispatcher; _jsonSerializer = jsonSerializer; _commandDispatcher = commandDispatcher; _messageInboxItemRepository = messageInboxItemRepository; LoadMessageMap(); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ZaminConfigurationOptions zaminConfigurations) { app.UseZaminMvcConfigure(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }, zaminConfigurations, env); }
public ParrotTranslator(ZaminConfigurationOptions configuration) { #if NET451 _currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.ToString(); #elif NET46 _currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.ToString(); #else _currentCulture = CultureInfo.CurrentCulture.ToString(); #endif _localizer = new ParrotDataWrapper(configuration); }
public ParrotDataWrapper(ZaminConfigurationOptions configuration) { _configuration = configuration; _dbConnection = new SqlConnection(configuration.Translator.Parrottranslator.ConnectionString); if (_configuration.Translator.Parrottranslator.AutoCreateSqlTable) { CreateTableIfNeeded(); } SelectCommand = string.Format(SelectCommand, configuration.Translator.Parrottranslator.SchemaName, configuration.Translator.Parrottranslator.TableName); InsertCommand = string.Format(InsertCommand, configuration.Translator.Parrottranslator.SchemaName, configuration.Translator.Parrottranslator.TableName); _localizationRecords = _dbConnection.Query <LocalizationRecord>(SelectCommand, commandType: CommandType.Text).ToList(); }
public RabbitMqMessageBus(ZaminConfigurationOptions configuration, IJsonSerializer jsonSerializer, IMessageConsumer messageConsumer) { _configuration = configuration; _jsonSerializer = jsonSerializer; _messageConsumer = messageConsumer; var connectionFactory = new ConnectionFactory { Uri = configuration.MessageBus.RabbitMq.Uri }; _connection = connectionFactory.CreateConnection(); var channel = _connection.CreateModel(); channel.ExchangeDeclare(configuration.MessageBus.RabbitMq.ExchangeName, ExchangeType.Topic, configuration.MessageBus.RabbitMq.ExchangeDurable, configuration.MessageBus.RabbitMq.ExchangeAutoDeleted); ReveiveMessages(); }
public static void UseZaminApiConfigure(this IApplicationBuilder app, ZaminConfigurationOptions configuration, IWebHostEnvironment env) { app.UseApiExceptionHandler(options => { options.AddResponseDetails = (context, ex, error) => { if (ex.GetType().Name == typeof(SqlException).Name) { error.Detail = "Exception was a database exception!"; } }; options.DetermineLogLevel = ex => { if (ex.Message.StartsWith("cannot open database", StringComparison.InvariantCultureIgnoreCase) || ex.Message.StartsWith("a network-related", StringComparison.InvariantCultureIgnoreCase)) { return(LogLevel.Critical); } return(LogLevel.Error); }; }); app.UseStatusCodePages(); if (configuration.Swagger != null && configuration.Swagger.SwaggerDoc != null) { app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint(configuration.Swagger.SwaggerDoc.URL, configuration.Swagger.SwaggerDoc.Title); c.RoutePrefix = string.Empty; }); } app.UseCors(builder => { builder.AllowAnyOrigin(); builder.AllowAnyHeader(); builder.AllowAnyMethod(); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public static IServiceCollection AddZaminMvcServices(this IServiceCollection services, IConfiguration configuration) { var _zaminConfigurations = new ZaminConfigurationOptions(); configuration.GetSection(_zaminConfigurations.SectionName).Bind(_zaminConfigurations); services.AddSingleton(_zaminConfigurations); services.AddControllersWithViews(options => { options.Filters.Add(typeof(TrackActionPerformanceFilter)); }).AddRazorRuntimeCompilation() .AddFluentValidation(); services.AddZaminDependencies(_zaminConfigurations.AssmblyNameForLoad.Split(',')); return(services); }
public static IServiceCollection AddZaminApiServices(this IServiceCollection services, IConfiguration configuration) { var _zaminConfigurations = new ZaminConfigurationOptions(); configuration.GetSection(_zaminConfigurations.SectionName).Bind(_zaminConfigurations); services.AddSingleton(_zaminConfigurations); services.AddScoped <ValidateModelStateAttribute>(); services.AddControllers(options => { options.Filters.AddService <ValidateModelStateAttribute>(); options.Filters.Add(typeof(TrackActionPerformanceFilter)); }).AddFluentValidation(); services.AddZaminDependencies(_zaminConfigurations.AssmblyNameForLoad.Split(',')); AddSwagger(services); return(services); }
public PoolingPublisherHostedService(ZaminConfigurationOptions configuration, IOutBoxEventItemRepository outBoxEventItemRepository, IMessageBus messageBus) { _configuration = configuration; _outBoxEventItemRepository = outBoxEventItemRepository; _messageBus = messageBus; }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ZaminConfigurationOptions zaminConfigurations) { app.UseZaminApiConfigure(zaminConfigurations, env); }
public SqlMessageInboxItemRepository(ZaminConfigurationOptions configurations) { _connectionString = configurations.Messageconsumer.SqlMessageInboxStore.ConnectionString; }
public static void UseZaminMvcConfigure(this IApplicationBuilder app, Action <IEndpointRouteBuilder> configur, ZaminConfigurationOptions configuration, IWebHostEnvironment env) { app.UseApiExceptionHandler(options => { options.AddResponseDetails = (context, ex, error) => { if (ex.GetType().Name == typeof(SqlException).Name) { error.Detail = "Exception was a database exception!"; } }; options.DetermineLogLevel = ex => { if (ex.Message.StartsWith("cannot open database", StringComparison.InvariantCultureIgnoreCase) || ex.Message.StartsWith("a network-related", StringComparison.InvariantCultureIgnoreCase)) { return(LogLevel.Critical); } return(LogLevel.Error); }; }); app.UseStatusCodePages(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); if (configuration?.Session?.Enable == true) { app.UseSession(); } app.UseEndpoints(configur); }
public SqlOutBoxEventItemRepository(ZaminConfigurationOptions configurations) { _configurations = configurations; }