// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); string buildVersion = Environment.GetEnvironmentVariable("BUILD_VERSION"); services .AddControllers(); services.AddSingleton <Microsoft.AspNetCore.Http.IHttpContextAccessor, Microsoft.AspNetCore.Http.HttpContextAccessor>(); services.AddHttpContextAccessor(); services.AddDbContext <DbDataContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DbDataContext")).UseLazyLoadingProxies()); services.AddDbContext <DbReadDataContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DbReadDataContext")).UseLazyLoadingProxies()); services.AddDbContext <NexusDataContext>(options => options.UseSqlServer(Configuration.GetConnectionString("NexusDatabase"))); services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.AddSwaggerGen(c => Swagger.Gen(Configuration, c, "User")); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseCors("CorsPolicy"); if (env.IsDevelopment()) //Is Development mode { Swagger.StartUpSwaggerConfigure(app); app.UseDeveloperExceptionPage(); } else if (env.IsProduction()) //Is Production mode { app.UseHsts(); } else if (env.IsStaging()) //Is Staging mode { app.UseHsts(); } app.UseAuthentication(); DefaultFiles.DefaultFilesConfigure(app, env); SignalRMapHub.SignalRMapHubConfigure(app); app.UseHttpsRedirection(); app.UseMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { var pathBase = Configuration["API_PATH_BASE"]; if (!string.IsNullOrWhiteSpace(pathBase)) { app.UsePathBase($"/{pathBase.TrimStart('/')}"); } app.UseDeveloperExceptionPage(); AppConfigUtilities._configuration = Configuration; AutofacContainer = app.ApplicationServices.GetAutofacRoot(); DomainEvents._Container = AutofacContainer.BeginLifetimeScope(); // DependencyConfig.RegisterEvent(); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseSwagger(c => Swagger.Use(Configuration, c)); app.UseSwaggerUI(c => Swagger.UseSwaggerUI(c, env, "User")); app.UseMiddleware <BasicAuthMiddleware>(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public Startup(IConfiguration configuration, IServiceProvider servicesProvider) { Configuration = configuration; ServicesProvider = servicesProvider; //proptechplus this._swagger = new Swagger(configuration); }
public void ConfigureServices(IServiceCollection services) { // [SystemConfigs] SystemConfigs.Service(services); // [Cros] Policy Cros.Service(services); // [Document API] Swagger Swagger.Service(services); // [Background Job] Hangfire Hangfire.Service(services); // [Caching] Redis Cache services.AddRedisCache(); // [Mini Response] WebMarkup WebMarkupMin.Service(services); // [Mapper] Auto Mapper services.AddAutoMapper(); // [MVC] Mvc.Service(services); // [Injection] Keep In Last DependencyInjection.Service(services); // [Database] Use Entity Framework Database.Service(services); }
public void ConfigureServices(IServiceCollection services) { var key = Configuration.GetSection("JwtSettings:SigningKey").Value; services.AddAuthentication(x => { x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(x => { x.RequireHttpsMetadata = false; x.SaveToken = true; x.TokenValidationParameters = Token.TokenParametersConfig(key); }); services.AddMediatR(typeof(Startup).Assembly); services.AddAutoMapper(typeof(CriarUsuarioHandler).Assembly); services.AddControllers().AddNewtonsoftJson(); services.Configure <DronePontoInicialConfig>(Configuration.GetSection("BaseDrone")); services.AddApplicationInsightsTelemetry(Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"]); HttpPagamentoClient.Registrar(services, Configuration["UrlBasePagamento"]); Swagger.Configurar(services); var producerConfig = new ProducerConfig(); Configuration.Bind("Producer", producerConfig); services.Configure <MongoDbConfig>(Configuration.GetSection("Mongo")); DependencyContainer.RegisterServices(services, producerConfig); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); //Enable Swagger Swagger.ConfigureServices(services, Configuration); }
public void ConfigureServices(IServiceCollection services) { DependencyInjections.Add(services); Swagger.Add(services); ControllersAndNewtonsoftJson.Add(services); HealthCheck.Add(services); HttpClient.Add(services, Configuration); }
public void Configure(IApplicationBuilder app, IApiVersionDescriptionProvider provider) { Swagger.Use(app, provider); HealthCheck.Use(app); app.UseRouting(); app.UseCors(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); DatabaseContext.Register(services, Configuration); DependencyInjection.Register(services, Configuration); Swagger.Register(services); }
public void TestMethod1() { var pet = new Swagger(); var myget = pet.Get(1); var getresult = "{\"id\":1,\"category\":{\"id\":0,\"name\":\"string\"},\"name\":\"2\",\"photoUrls\":[\"string\"],\"tags\":[{\"id\":0,\"name\":\"string\"}],\"status\":\"3\"}"; Assert.AreEqual(myget, getresult); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers(); Swagger.Configurar(services); services.AddScoped <IPedidoProducerService, PedidoProducerService>(); services.Configure <KafkaConfig>(Configuration.GetSection("Kafka")); }
public void Configuration(IAppBuilder appBuilder) { HttpConfiguration httpConfiguration = new HttpConfiguration(); WebApi.Configure(httpConfiguration); Swagger.Configure(httpConfiguration); appBuilder.UseWebApi(httpConfiguration); }
public static void ConfigureServices(IConfiguration configuration, IServiceCollection services) { Mvc.ConfigureService(configuration, services); Swagger.ConfigureService(configuration, services); ApiVersioning.ConfigureService(services); services.AddAutoMapper(); AplicacaoConfiguracao.ConfigureService(configuration, services); Repositories.ConfigureService(services); ApiServices.ConfigureService(services); }
public static void Main(string[] args) { Console.WriteLine("Hello World!"); // TODO: Implement Functionality Here Swagger swagger = new Swagger(); Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddNewtonsoftJson(); services.AddMediatR(typeof(Startup).Assembly); //Adicionar acesso aos endpoint do microservico de entregas HttpPedidoClient.Registrar(services, Configuration["UrlBasePedido"]); Swagger.Configurar(services); DependencyContainer.RegisterServices(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services .AddControllers() .AddNewtonsoftJson(options => options.SerializerSettings.Converters.Add(new StringEnumConverter())); services.AddSingleton(Configuration); RegisterContainers.ConfigureServices(services); RegisterDbContainer.ConfigureServices(services, Configuration["Settings:DbLocation"]); Swagger.ConfigureServices(services); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers(); Swagger.Configurar(services); services.AddScoped <IOperationCreate, Create>(); services.AddScoped <IOperationRepository, OperationRepository>(); services.AddScoped <MongoDbContext>(); services.Configure <DbConfig>(Configuration.GetSection("MongoDb")); }
/// <summary> /// This method gets called by the runtime. Use this method to add services to the container. /// </summary> /// <param name="services">Services Collection</param> public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => { //options.Filters.Add<CustomExceptionsFilter>(); options.Filters.Add <ValidateModelStateAttribute>(); }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1); //Cors.Register(Configuration, services); //Authorization.Register(services); //Authentication.Register(services, Configuration, Environment); Repositories.Register(services); Swagger.Register(services); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { Swagger.AppBuild(app); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddNewtonsoftJson(); services.AddMediatR(typeof(Startup).Assembly); HttpPedidoClient.Registrar(services, Configuration["UrlBaseEntrega"]); Swagger.Configurar(services); var producerConfig = new ProducerConfig(); Configuration.Bind("Producer", producerConfig); DependencyContainer.RegisterServices(services, producerConfig); }
public static void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); app.UseHttpsRedirection(); } Swagger.Configure(app); Mvc.Configure(app); }
public void ConfigureServices(IServiceCollection services) { services.AddDirectoryBrowser(); services.AddSignalR(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); AuthenticationConfig.AuthenticationConfigServices(services, Configuration); CORS.CORSServices(services); DependencyInjection.DependencyInjectionServices(services); Swagger.StartUpSwaggerConfigureServices(services); }
/// <summary> /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. /// </summary> /// <param name="app">Application Builder</param> public void Configure(IApplicationBuilder app) { if (Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } // Error Page Redirection //Localization.Configure(app); Swagger.Configure(app, Environment); //app.UseAuthentication(); app.UseHttpsRedirection(); app.UseMvc(); }
/// <summary> /// This method gets called by the runtime. Use this method to add services to the container. /// </summary> /// <param name="services">Services Collection</param> public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => { options.Filters.Add <CustomExceptionsFilter>(); options.Filters.Add <NotificationFilter>(); options.Filters.Add <ValidateModelStateAttribute>(); }).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); //Cors.Register(Configuration, services); //Authorization.Register(services); //Authentication.Register(services, Configuration, Environment); DependencyInjection.Register(services); Swagger.Register(services); HealthCheck.Register(services, Configuration); Compression.Register(services); }
public static string envio_correo(SqlString from, SqlString to, SqlString subject, SqlString htmlbody, SqlString textbody) { string gRequest = ""; try { Swagger Swagger = new Swagger(); Ent_Swagger data = new Ent_Swagger(); data.From = from; data.To = to; data.Subject = subject; data.HtmlBody = htmlbody; data.TextBody = textbody; //data.From = "*****@*****.**"; //data.To = "*****@*****.**"; //data.Subject = "titulo email"; //data.HtmlBody = "<h1>hola2</h1>"; //data.TextBody = "Que tal"; //string jsonData = js.Serialize(data); //var jsonData1 = (JsonConvert.DeserializeObject)data;//js.Serialize(data); //var serializer = new JavaScriptSerializer(); //var ss=n //var jsonData = JsonConvert.SerializeObject(data); //var jsondata = Correo.JsonConverter.Serialize(data); string jsonData = convert_object_jason(data); gRequest = Swagger.sendEmail(jsonData); //JavaScriptSerializer js = new JavaScriptSerializer(); //var jsonData = JsonConvert.DeserializeObject<>(data);//js.Serialize(data); //gRequest = Swagger.sendEmail(jsonData); } catch (Exception exc) { gRequest = exc.Message; } return(gRequest); }
/// <summary> /// Activates the WorkBench and the middleware of its services previously initiated. /// </summary> /// <param name="builder">The builder of the core application</param> /// <returns>The builder of the core application</returns> public static IServiceCollection AddWorkBench(this IServiceCollection service, IConfiguration Configuration, bool hasIdentityServer = false) { WorkBench.Configuration = Configuration; //Add Secrets options WorkBench.Configuration = Configuration.UseSecrets(); service.AddHttpContextAccessor(); //Inject Swagger (Open API specification) and API Versioning WebApiVersion.AddApiVersion(service); Swagger.AddSwagger(service); //Inject JWT pattern and security AuthenticationExtension.AddAuth(service, hasIdentityServer); TelemetryExtensions.AddTelemetry(service); return(service); }
// First arg indicates what file we should save the generated code to. static void Main(string[] args) { if (args.Length != 1) { throw new Exception("Expected exactly one argument, which is the target file name of the generated TS code."); } var settings = new SwaggerToTypeScriptClientGeneratorSettings { ClassName = "SD2{controller}Api", GenerateClientInterfaces = true, Template = TypeScriptTemplate.Angular }; var swaggerDoc = Swagger.GenerateSwaggerDocument().Result; var generator = new SwaggerToTypeScriptClientGenerator(swaggerDoc, settings); var typescriptCode = generator.GenerateFile(); File.WriteAllText(args[0], typescriptCode); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); Swagger.Builder(app); app.UseRouting(); RewriteAction.DefaultUrl(app); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { // [Important] The order of middleware very important for request and response handle! // Don't mad it !!! // [SystemConfigs] SystemConfigs.Middleware(app, loggerFactory); // Migrate Database app.DatabaseMigrate(); // [Response] Information ProcessingTimeMiddleware.Middleware(app); SystemInfoMiddleware.Middleware(app); // [Cros] Policy Cros.Middleware(app); // [Log] Serilog Log.Middleware(app, loggerFactory); // [Exception] Exception.Middleware(app); // [Security] Identity Server IdentityServer.Middleware(app); // [Document API] Swagger Swagger.Middleware(app); // [Background Job] Hangfire Hangfire.Middleware(app); // [Mini Response] WebMarkup WebMarkupMin.Middleware(app); // [MVC] Keep In Last Mvc.Middleware(app); }