示例#1
0
文件: Startup.cs 项目: Xerbeth/Ruleta
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            services.AddScoped <IDocumentTypeServices, DocumentTypeServices>();
            services.AddScoped <IBetTypeServices, BetTypeServices>();
            services.AddScoped <IRouletteServices, RouletteServices>();
            services.AddScoped <IRouletteTransactions, RouletteTransactions>();
            services.AddScoped <IRouletteConfigurationServices, RouletteConfigurationServices>();
            services.AddScoped <IBetTransactions, BetTransactions>();
            services.AddSingleton(Configuration);

            StartupServices.ConfigureServices(services, connectionString);
            StartupTransactions.ConfigureServices(services, connectionString);

            services.AddControllers();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "ROULETTE API", Version = "v1"
                });
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
                c.CustomSchemaIds(type => type.ToString());
            });
        }
示例#2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            services.AddScoped <IAirplanesTypesServices, AirplanesTypesServices>();
            services.AddControllers();

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1",
                                   new Microsoft.OpenApi.Models.OpenApiInfo
                {
                    Title       = "Airport Service API",
                    Description = "API for airport controller",
                    Version     = "v1"
                });

                var fileName = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var filePath = Path.Combine(AppContext.BaseDirectory, fileName);

                options.IncludeXmlComments(filePath);
            });

            StartupServices.ConfigureServices(services, connectionString);
        }
示例#3
0
        public static void ConfigureServices(IServiceCollection services, string connectionString)
        {
            services.AddScoped <IRouletteServices, RouletteServices>();
            services.AddScoped <IRouletteConfigurationServices, RouletteConfigurationServices>();
            services.AddScoped <IPlayerServices, PlayerServices>();
            services.AddScoped <IBetTypeServices, BetTypeServices>();
            services.AddScoped <IBetServices, BetServices>();

            StartupServices.ConfigureServices(services, connectionString);
        }
示例#4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //to validate the token,
            StartupServices.Authenticate(services);

            StartupServices.AddDBContext(services, Configuration);

            StartupServices.AddCors(services);

            StartupServices.AddSwagger(services);

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
示例#5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            #region Automapper
            services.AddAutoMapper(typeof(Startup));
            services.AddControllersWithViews();
            #endregion Automapper

            var connectionString = Configuration.GetConnectionString("DefaultConnection");
            services.AddScoped <IDocumentTypeServices, DocumentTypeServices>();
            services.AddScoped <IPersonServices, PersonServices>();
            services.AddScoped <ICorrespondenceServices, CorrespondenceServices>();
            services.AddScoped <ICorrespondenceFilesServices, CorrespondenceFilesServices>();
            StartupServices.ConfigureServices(services, connectionString);

            services.AddControllers();

            #region Swagger
            services.AddSwaggerGen(options =>
            {
                var groupName = "v1";

                options.SwaggerDoc(groupName, new OpenApiInfo
                {
                    Title       = $"AlphaTIC {groupName}",
                    Version     = groupName,
                    Description = "AlphaTIC API",
                    Contact     = new OpenApiContact
                    {
                        Name  = "Xerbeth",
                        Email = "*****@*****.**",
                        Url   = new Uri("https://github.com/Xerbeth/ALPHA_TIC"),
                    }
                });
            });
            #endregion Swagger
        }
 private static void RegisterServices()
 {
     _builder.RegisterInstance(StartupServices.GetDataStore());
 }
示例#7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            StartupServices.Configure(services, Configuration);
        }