// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var mappingConfig = new MapperConfiguration(mc => { mc.AddProfile(new PlayersServiceMappings()); }); IMapper mapper = mappingConfig.CreateMapper(); services.AddSingleton(mapper); services.AddMvc(option => option.EnableEndpointRouting = false); services.AddDbContext <PlayersDbContext>(options => options.UseLazyLoadingProxies().UseSqlServer("Server=db, 1433;Database=playersDb;User=sa;Password=#Tgp-password;")); var builder = ConveyBuilder .Create(services) .AddCommandHandlers() .AddQueryHandlers() .AddEventHandlers() .AddInMemoryEventDispatcher() .AddInMemoryQueryDispatcher() .AddInMemoryCommandDispatcher() .AddRabbitMq <CorrelationContext>(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Title = "Players API", Version = "v1" }); }); }
public static IConveyBuilder AddConvey(this IServiceCollection services, string sectionName = SectionName, IConfiguration configuration = null) { if (string.IsNullOrWhiteSpace(sectionName)) { sectionName = SectionName; } var builder = ConveyBuilder.Create(services, configuration); var options = builder.GetOptions <AppOptions>(sectionName); builder.Services.AddMemoryCache(); services.AddSingleton(options); services.AddSingleton <IServiceId, ServiceId>(); if (!options.DisplayBanner || string.IsNullOrWhiteSpace(options.Name)) { return(builder); } var version = options.DisplayVersion ? $" {options.Version}" : string.Empty; Console.WriteLine(Figgle.FiggleFonts.Doom.Render($"{options.Name}{version}")); return(builder); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => options.AddPolicy("TGPPolicy", p => p.WithOrigins("http://localhost:4200") .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials())); var appSettingsSection = Configuration.GetSection("AppSettings"); services.Configure <AppSettings>(appSettingsSection); services.AddMvc(option => option.EnableEndpointRouting = false); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Title = "Identity API", Version = "v1" }); }); services.AddDbContext <IdentityContext>(options => options.UseSqlServer("Server=db, 1433;Database=identityDb;User=sa;Password=#Tgp-password;")); services.AddScoped <IIdentityService, IdentityService>(); var builder = ConveyBuilder .Create(services) .AddRabbitMq <CorrelationContext>() .Build(); }
private static void ConfigureConvey(IServiceCollection services) { services.AddConvey(); var builder = ConveyBuilder .Create(services) .AddCommandHandlers() .AddInMemoryCommandDispatcher() .AddMetrics(); builder.Build(); }
public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); return(ConveyBuilder .Create(services) .AddRabbitMq <CorrelationContext>() .AddMongo() .AddMongoRepository <MessageDocument, Guid>("messages") .AddJaeger() .Build()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var appsettings = new Settings.Appsettings(); Configuration.Bind(appsettings); services.AddControllers(); var dbContext = new MongoContext(appsettings.MongoDB.ConnectionString, appsettings.MongoDB.Database); services.AddSingleton(typeof(MongoContext), dbContext); ConveyBuilder.Create(services) .AddCommandHandlers().AddInMemoryCommandDispatcher() .AddQueryHandlers().AddInMemoryQueryDispatcher(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddMvc(option => option.EnableEndpointRouting = false); services.AddDbContext <GamificationDbContext>(options => options.UseLazyLoadingProxies().UseSqlServer("Server=db, 1433;Database=GamificationDb;User=sa;Password=#Tgp-password;")); var builder = ConveyBuilder .Create(services) .AddCommandHandlers() .AddQueryHandlers() .AddInMemoryQueryDispatcher() .AddInMemoryCommandDispatcher(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Title = "Gamification API", Version = "v1" }); }); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddDbContext <TrainingsDbContext>(options => options.UseLazyLoadingProxies().UseSqlServer("Server=db, 1433;Database=trainingsDb;User=sa;Password=#Tgp-password;")); services.AddMvc(option => option.EnableEndpointRouting = false); services.AddHttpClient <IPlayersServiceClient, PlayersServiceClient>(); services.Configure <PlayersServiceClientOptions>(options => Configuration.GetSection("PlayersServiceClientOptions").Bind(options)); var builder = ConveyBuilder .Create(services) .AddCommandHandlers() .AddQueryHandlers() .AddInMemoryQueryDispatcher() .AddInMemoryCommandDispatcher() .AddInMemoryEventDispatcher() .AddRabbitMq <CorrelationContext>() .AddEventHandlers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Title = "Trainings API", Version = "v1" }); }); }