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.

66 lines
1.7 KiB

3 weeks ago
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.IdentityModel.Tokens;
using ReZero;
using ReZero.Configuration;
using ReZero.SuperAPI;
using SqlSugar;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using Microsoft.AspNetCore.Cors;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
//ע<EFBFBD><EFBFBD>db: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>ע<EFBFBD><EFBFBD>
builder.Services.AddScoped<ISqlSugarClient>(it =>
{
var config = ApiConfiguration.GetJsonValue<ReZeroJson>("ReZero");
return new SqlSugarClient(new ConnectionConfig()
{
DbType = config!.BasicDatabase!.DbType,
ConnectionString = config!.BasicDatabase!.ConnectionString,
IsAutoCloseConnection = true
});
});
//builder.Services.AddCors();
//ע<EFBFBD><EFBFBD>ReZero.Api
builder.Services.AddReZeroServices(api =>
{
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿɻ<EFBFBD>json<EFBFBD>ļ<EFBFBD>
var apiObj = SuperAPIOptions.GetOptions();
//IOCҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD>̼<EFBFBD>
var assemblyList = Assembly.GetExecutingAssembly()
3 days ago
.GetAllDependentAssemblies(it => it.Contains("medical.insu.transfomer"))
3 weeks ago
.ToArray();
apiObj!.DependencyInjectionOptions = new DependencyInjectionOptions(assemblyList);
//<EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD>API
api.EnableSuperApi(apiObj);
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();