Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            CustomerCache.Initialize(); //initializes the Solana customer databases
            RegisterDependencies(services);

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Solana Web API Documentation", Version = "v1"
                });

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

                c.CustomSchemaIds(x => x.FullName);
                c.IncludeXmlComments(xmlPath);
                c.OperationFilter <SolanaHeadersOperationFilter>();
            });

            services.AddAutoMapper(
                config => config.ValidateInlineMaps = false, //this disables Destination members validation (i.e. Destination members do not all have to be mapped from Source)
                Assembly.GetAssembly(typeof(AdmUserMappingProfile)));

            ConfigureJwtAuth(services);
        }