添加excel模块

This commit is contained in:
橙子
2023-01-16 23:05:01 +08:00
parent 46b176fc59
commit 034abb06ad
159 changed files with 328 additions and 97 deletions

View File

@@ -0,0 +1,54 @@
using Yi.Framework.Application;
using Yi.Framework.Application.Contracts;
using Yi.Framework.Core;
using Yi.Framework.Core.Autofac.Extensions;
using Yi.Framework.Core.Autofac.Modules;
using Yi.Framework.Core.AutoMapper;
using Yi.Framework.Core.Extensions;
using Yi.Framework.Core.Sqlsugar;
using Yi.Framework.Ddd;
using Yi.Framework.Domain;
using Yi.Framework.Domain.Shared;
using Yi.Framework.Sqlsugar;
using Yi.Framework.Web;
TimeTest.Start();
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls(builder.Configuration.GetValue<string>("StartUrl"));
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
builder.UseYiModules(
typeof(YiFrameworkCoreModule).Assembly,
typeof(YiFrameworkCoreAutoMapperModule).Assembly,
typeof(YiFrameworkDddModule).Assembly,
typeof(YiFrameworkCoreSqlsugarModule).Assembly,
typeof(YiFrameworkSqlsugarModule).Assembly,
typeof(YiFrameworkDomainSharedModule).Assembly,
typeof(YiFrameworkDomainModule).Assembly,
typeof(YiFrameworkApplicationContractsModule).Assembly,
typeof(YiFrameworkApplicationModule).Assembly,
typeof(YiFrameworkWebModule).Assembly
);
//<2F><><EFBFBD><EFBFBD>autofacģ<63><C4A3>,<2C><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
builder.Host.ConfigureAutoFacContainer(container =>
{
container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiFrameworkWebModule).Assembly);
});
var app = builder.Build();
var t = app.Services.GetService<Test2Entity>();
app.MapControllers();
app.Run();

View File

@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"Yi.Framework.Web": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:19002",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,11 @@
using Yi.Framework.Core.Attributes;
using Yi.Framework.Core.DependencyInjection;
namespace Yi.Framework.Web
{
public class Test2Entity: ITransientDependency
{
[Autowired]
public TestEntity testEntity { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using Yi.Framework.Core.DependencyInjection;
namespace Yi.Framework.Web
{
public class TestEntity: ITransientDependency
{
}
}

View File

@@ -0,0 +1,26 @@
using System.Diagnostics;
namespace Yi.Framework.Web
{
public class TimeTest
{
public static Stopwatch Stopwatch { get; set; }
public static void Start()
{
Stopwatch=new Stopwatch();
Stopwatch.Start();
}
public static void Result()
{
Stopwatch.Stop();
string time = Stopwatch.ElapsedMilliseconds.ToString();
Stopwatch.Restart();
string res = $"{DateTime.Now.ToString("yyyy:MM:dd-HH:mm:ss")}本次运行启动时间为:{time}毫秒\r\n";
Console.WriteLine(res);
File.AppendAllText("./TimeTest.txt", res);
}
}
}

View File

@@ -0,0 +1,9 @@
2023:01:16-22:36:40本次运行启动时间为2089毫秒
2023:01:16-22:36:49本次运行启动时间为2021毫秒
2023:01:16-22:37:01本次运行启动时间为2072毫秒
2023:01:16-22:39:23本次运行启动时间为2075毫秒
2023:01:16-22:40:48本次运行启动时间为2172毫秒
2023:01:16-22:41:12本次运行启动时间为2142毫秒
2023:01:16-22:42:05本次运行启动时间为2008毫秒
2023:01:16-22:43:22本次运行启动时间为1910毫秒
2023:01:16-22:44:33本次运行启动时间为2017毫秒

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\framework\Yi.Framework.Core.Autofac\Yi.Framework.Core.Autofac.csproj" />
<ProjectReference Include="..\Yi.Framework.Application\Yi.Framework.Application.csproj" />
<ProjectReference Include="..\Yi.Framework.Sqlsugar\Yi.Framework.Sqlsugar.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,41 @@
using AspNetCore.Microsoft.AspNetCore.Builder;
using StartupModules;
using Yi.Framework.Application;
namespace Yi.Framework.Web
{
/// <summary>
/// 这里是最后执行的模块
/// </summary>
public class YiFrameworkWebModule : IStartupModule
{
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
//添加控制器与动态api
services.AddControllers();
services.AddAutoApiService(opt =>
{
//NETServiceTest所在程序集添加进动态api配置
opt.CreateConventional(typeof(YiFrameworkApplicationModule).Assembly, option => option.RootPath = string.Empty);
});
//添加swagger
services.AddSwaggerServer<YiFrameworkApplicationModule>();
}
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
//if (app.Environment.IsDevelopment())
{
app.UseSwaggerServer();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseRouting();
TimeTest.Result();
}
}
}

View File

@@ -0,0 +1,29 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
//程序启动地址,*代表全部网口
"StartUrl": "http://*:19002",
//数据库类型列表
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
"DbConnOptions": {
"Url": "DataSource=yi-sqlsugar-dev.db",
"DbType": "Sqlite",
"EnabledDbSeed": false,
"EnabledReadWrite": false,
"EnabledCodeFirst": false,
"EntityAssembly": null,
"ReadUrl": [
"DataSource=[xxxx]", //sqlite
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //mysql
"Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //sqlserver
]
}
}