You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6 KiB
C#

using SqlSugar;
using System.ComponentModel;
using Txgy.RBS.IServices;
using Txgy.RBS.Server.WebApi.Register;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Register(); //ҵ<><D2B5><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
//֧<><D6A7>Automapperӳ<72><D3B3>
builder.Services.AddAutoMapper(typeof(AutoMapObject));
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
//<2F><><EFBFBD><EFBFBD>sqlsugar
builder.Services.AddTransient<ISqlSugarClient>(context =>
{
string con = builder.Configuration.GetConnectionString("ConnectionSqlite");
SqlSugarClient client = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = builder.Configuration.GetConnectionString("ConnectionSqlite"),
DbType = DbType.Sqlite,
InitKeyType = InitKeyType.Attribute,
});
//֧<><D6A7>sql<71><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>
client.Aop.OnLogExecuting = (sql, par) =>
{
Console.WriteLine("\r\n");
Console.WriteLine($"Sql<71><6C><EFBFBD><EFBFBD>:{sql}");
Console.WriteLine($"======================================================================");
};
return client;
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();