Browse Source

init

GOIAggregation
sanji 2 years ago
parent
commit
bc459eddf4
  1. 46
      SiNan.API/Program.cs
  2. 19
      SiNan.Business/BaseBusiness.cs
  3. 16
      SiNan.Business/GOIBusiness.cs
  4. 2
      SiNan.Common/Log/NLogManager.cs

46
SiNan.API/Program.cs

@ -1,14 +1,15 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Newtonsoft.Json.Serialization;
using SiNan.API.Filters;
using SiNan.API.Middlewares;
using SiNan.Business;
using SiNan.Common.Http;
using SiNan.Common.Log;
using Yitter.IdGenerator;
using Newtonsoft.Json.Serialization;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using System.Text;
using Microsoft.OpenApi.Models;
using System.Reflection;
using System.Text;
using Yitter.IdGenerator;
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
@ -127,21 +128,30 @@ services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(
var app = builder.Build();
app.UseMiddleware<CustomExceptionMiddleWare>();
app.UseRouting();
app.UseCors("cors");
app.UseMiddleware<ClientVersionValidationMiddleWare>();
app.UseAuthorization();
app.MapControllers();
app.Run();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
//if (!app.Environment.IsDevelopment())
//{
// app.UseExceptionHandler("/Error");
// // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
// app.UseHsts();
//}
app.UseHttpsRedirection();
app.UseStaticFiles();
//app.UseHttpsRedirection();
//app.UseStaticFiles();
app.UseRouting();
//app.UseRouting();
app.UseAuthorization();
//app.UseAuthorization();
app.MapRazorPages();
//app.MapRazorPages();
app.Run();
//app.Run();

19
SiNan.Business/BaseBusiness.cs

@ -0,0 +1,19 @@
using SiNan.Common.Log;
using Yitter.IdGenerator;
namespace SiNan.Business
{
public class BaseBusiness
{
protected IFreeSql fsql;
protected NLogManager nLogManager;
protected IIdGenerator idGenerator;
public BaseBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator)
{
this.fsql = fsql;
this.nLogManager = nLogManager;
this.idGenerator = idGenerator;
}
}
}

16
SiNan.Business/GOIBusiness.cs

@ -0,0 +1,16 @@
using SiNan.Common.Log;
using SiNan.Common.Models;
using Yitter.IdGenerator;
namespace SiNan.Business
{
public class GOIBusiness : BaseBusiness, IDenpendency
{
private FreeSqlMultiDBManager freeSqlMultiDBManager;
public GOIBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, FreeSqlMultiDBManager freeSqlMultiDBManager) : base(fsql, nLogManager, idGenerator)
{
this.freeSqlMultiDBManager = freeSqlMultiDBManager;
}
}
}

2
SiNan.Common/Log/NLogManager.cs

@ -1,7 +1,7 @@
using NLog;
using System.Collections.Concurrent;
namespace BBWYB.Common.Log
namespace SiNan.Common.Log
{
public class NLogManager
{

Loading…
Cancel
Save