コード例 #1
0
ファイル: Program.cs プロジェクト: Rexsunon/AirlineSendAgent
        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
ファイル: Startup.cs プロジェクト: BuRexie/GameTrack
        // 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
ファイル: Startup.cs プロジェクト: Rexsunon/AirlineWeb
 // 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
ファイル: Startup.cs プロジェクト: Rexsunon/TravelAgentWeb
 // 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"
         });
     });
 }