添加代码生成模块

This commit is contained in:
橙子
2023-01-21 18:09:21 +08:00
parent 9b1b915925
commit 1f702c20ae
69 changed files with 828 additions and 7 deletions

View File

@@ -0,0 +1,34 @@
using AspNetCore.Microsoft.AspNetCore.Hosting;
using Yi.Framework.Core.Autofac.Extensions;
using Yi.Framework.Core.Autofac.Modules;
using Yi.Framework.Core.Extensions;
using Yi.Framework.Web;
TimeTest.Start();
var builder = WebApplication.CreateBuilder(args);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>url
builder.WebHost.UseStartUrlsServer(builder.Configuration);
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
builder.UseYiModules(typeof(YiFrameworkWebModule));
//<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>();
//ȫ<>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
app.UseErrorHandlingServer();
app.UseAuthentication();
app.UseAuthorization();
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,10 @@
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,77 @@
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毫秒
2023:01:17-17:30:46本次运行启动时间为23171毫秒
2023:01:17-17:45:11本次运行启动时间为4771毫秒
2023:01:17-17:45:54本次运行启动时间为1917毫秒
2023:01:17-17:48:04本次运行启动时间为2138毫秒
2023:01:17-17:57:41本次运行启动时间为1907毫秒
2023:01:17-17:58:29本次运行启动时间为1895毫秒
2023:01:17-17:58:43本次运行启动时间为1937毫秒
2023:01:17-17:59:38本次运行启动时间为1856毫秒
2023:01:17-21:06:57本次运行启动时间为2285毫秒
2023:01:17-21:09:32本次运行启动时间为2007毫秒
2023:01:17-21:10:16本次运行启动时间为1862毫秒
2023:01:17-21:12:25本次运行启动时间为2055毫秒
2023:01:17-21:13:46本次运行启动时间为5606毫秒
2023:01:17-21:14:35本次运行启动时间为4824毫秒
2023:01:17-21:18:17本次运行启动时间为8985毫秒
2023:01:17-21:19:48本次运行启动时间为1859毫秒
2023:01:17-21:21:32本次运行启动时间为1786毫秒
2023:01:17-22:41:17本次运行启动时间为1901毫秒
2023:01:17-22:42:21本次运行启动时间为1946毫秒
2023:01:17-22:42:55本次运行启动时间为1970毫秒
2023:01:17-22:43:56本次运行启动时间为2023毫秒
2023:01:17-22:45:25本次运行启动时间为1803毫秒
2023:01:17-22:45:52本次运行启动时间为1877毫秒
2023:01:17-23:24:07本次运行启动时间为1836毫秒
2023:01:17-23:29:20本次运行启动时间为1958毫秒
2023:01:17-23:45:25本次运行启动时间为2016毫秒
2023:01:18-19:34:47本次运行启动时间为2631毫秒
2023:01:18-19:36:58本次运行启动时间为2551毫秒
2023:01:18-19:40:12本次运行启动时间为1978毫秒
2023:01:19-13:52:51本次运行启动时间为2600毫秒
2023:01:19-13:54:09本次运行启动时间为2180毫秒
2023:01:19-13:54:43本次运行启动时间为2122毫秒
2023:01:19-13:55:58本次运行启动时间为2355毫秒
2023:01:19-14:03:10本次运行启动时间为2144毫秒
2023:01:19-14:08:44本次运行启动时间为2279毫秒
2023:01:19-14:13:40本次运行启动时间为2188毫秒
2023:01:19-14:28:11本次运行启动时间为2207毫秒
2023:01:19-14:31:37本次运行启动时间为2216毫秒
2023:01:19-14:35:15本次运行启动时间为2428毫秒
2023:01:19-14:38:41本次运行启动时间为2141毫秒
2023:01:19-14:40:57本次运行启动时间为2220毫秒
2023:01:19-14:47:12本次运行启动时间为2234毫秒
2023:01:19-14:49:25本次运行启动时间为2202毫秒
2023:01:19-14:51:18本次运行启动时间为2175毫秒
2023:01:19-14:53:52本次运行启动时间为2250毫秒
2023:01:19-14:54:38本次运行启动时间为2145毫秒
2023:01:19-14:55:21本次运行启动时间为2123毫秒
2023:01:19-15:20:38本次运行启动时间为2486毫秒
2023:01:19-15:22:37本次运行启动时间为2251毫秒
2023:01:19-15:26:31本次运行启动时间为2182毫秒
2023:01:19-15:28:47本次运行启动时间为2187毫秒
2023:01:19-15:29:07本次运行启动时间为2163毫秒
2023:01:19-15:29:57本次运行启动时间为2307毫秒
2023:01:19-15:35:21本次运行启动时间为3172毫秒
2023:01:19-17:47:34本次运行启动时间为2598毫秒
2023:01:19-17:52:49本次运行启动时间为1940毫秒
2023:01:19-17:54:41本次运行启动时间为1861毫秒
2023:01:19-17:57:37本次运行启动时间为1945毫秒
2023:01:20-18:25:59本次运行启动时间为43382毫秒
2023:01:20-18:29:09本次运行启动时间为2173毫秒
2023:01:20-18:32:14本次运行启动时间为2397毫秒
2023:01:20-18:34:14本次运行启动时间为2126毫秒
2023:01:20-18:38:36本次运行启动时间为2152毫秒
2023:01:20-18:45:15本次运行启动时间为7203毫秒
2023:01:20-18:50:46本次运行启动时间为6513毫秒
2023:01:20-18:53:16本次运行启动时间为5186毫秒
2023:01:20-19:01:36本次运行启动时间为5194毫秒
2023:01:21-15:04:00本次运行启动时间为7763毫秒

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<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>
<ItemGroup>
<None Update="key.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,46 @@
using AspNetCore.Microsoft.AspNetCore.Builder;
using StartupModules;
using Yi.Framework.Application;
using Yi.Framework.Auth.JwtBearer;
using Yi.Framework.Core;
using Yi.Framework.Core.Attributes;
using Yi.Framework.Sqlsugar;
namespace Yi.Framework.Web
{
[DependsOn(
typeof(YiFrameworkSqlsugarModule),
typeof(YiFrameworkApplicationModule)
)]
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,38 @@
{
"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
]
},
"JwtTokenOptions": {
"Audience": "yi",
"Issuer": "localhost:19002",
"Subject": "yiframwork",
"ExpSecond": 3600
}
}

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAA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