You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.5 KiB
74 lines
2.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using LinqToDB.AspNet;
|
|
using LinqToDB.AspNet.Logging;
|
|
using LinqToDB.Configuration;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.OpenApi.Models;
|
|
using WatchDog;
|
|
|
|
namespace SyBaseTestWebApp
|
|
{
|
|
public class Startup
|
|
{
|
|
public Startup(IConfiguration configuration)
|
|
{
|
|
Configuration = configuration;
|
|
}
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddLinqToDBContext<AppDataConnection>((provider, options) => {
|
|
options
|
|
//will configure the AppDataConnection to use
|
|
//sqite with the provided connection string
|
|
//there are methods for each supported database
|
|
.UseAse(Configuration.GetConnectionString("Default"))
|
|
//default logging will log everything using the ILoggerFactory configured in the provider
|
|
.UseDefaultLogging(provider);
|
|
});
|
|
|
|
services.AddWatchDogServices();
|
|
|
|
services.AddControllers();
|
|
services.AddSwaggerGen(c =>
|
|
{
|
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "SyBaseTestWebApp", Version = "v1" });
|
|
});
|
|
}
|
|
|
|
// 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.UseSwagger();
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SyBaseTestWebApp v1"));
|
|
}
|
|
app.UseWatchDog(opt =>
|
|
{
|
|
opt.WatchPageUsername = "admin"; opt.WatchPagePassword = "Qwerty@123";
|
|
});
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.UseEndpoints(endpoints =>
|
|
{
|
|
endpoints.MapControllers();
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|