Пример #1
0
        static void Main(string[] args)
        {
            var host = Host.CreateDefaultBuilder()
                       .ConfigureServices((context, services) => {
                services.AddSingleton <IAppHost, AppHost>();
                services.AddSingleton <IWebhookClient, WebhookClient>();
                services.AddDbContext <SendAgentDbContext>(opt =>
                                                           opt.UseMySql(context.Configuration.GetConnectionString("AirlineConnection"),
                                                                        MySqlServerVersion.AutoDetect(context.Configuration.GetConnectionString("AirlineConnection")))
                                                           );

                services.AddHttpClient();
            }).Build();

            host.Services.GetService <IAppHost>().Run();
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "GameTrack", Version = "v1"
                });
            });

            // setup connection string
            services.AddDbContextFactory <GameTrackDbContext>(opt => opt.UseMySql(
                                                                  Configuration.GetConnectionString("GameTrackConnectionString"),
                                                                  MySqlServerVersion.AutoDetect(Configuration.GetConnectionString("GameTrackConnectionString")))
                                                              );

            // services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
        }
Пример #3
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddDbContext <AirlineDbContext>(opt => opt.UseMySql(Configuration.GetConnectionString("AirlineConnection"), MySqlServerVersion.AutoDetect(Configuration.GetConnectionString("AirlineConnection"))));
     // services.AddDbContext<AirlineDbContext>(opt => opt.UseSqlite(Configuration.GetConnectionString("AirlineConnectionLite")));
     services.AddControllers();
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new OpenApiInfo {
             Title = "AirlineWeb", Version = "v1"
         });
     });
     // Configure AutoMapper
     services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
     services.AddSingleton <IMessageBusClient, MessageBusClient>(); // Register message bus as a service.
 }
Пример #4
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddDbContext <TravelAgentDbContext>(opt => opt.UseMySql(Configuration.GetConnectionString("TravelAgentConnection"), MySqlServerVersion.AutoDetect(Configuration.GetConnectionString("TravelAgentConnection"))));
     // services.AddDbContext<TravelAgentDbContext>(opt => opt.UseSqlite(Configuration.GetConnectionString("TravelAgentConnectionLite")));
     services.AddControllers();
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new OpenApiInfo {
             Title = "TravelAgentWeb", Version = "v1"
         });
     });
 }