From 46b176fc593ebf6cad225852ac6ba27c871bca9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Mon, 16 Jan 2023 21:10:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E9=97=B4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yi.Framework.Core.csproj | 7 +++++- .../YiFrameworkCoreModule.cs | 1 - src/Yi.Framework/Yi.Framework.Web/Program.cs | 11 +++++---- src/Yi.Framework/Yi.Framework.Web/TimeTest.cs | 23 +++++++++++++++++++ .../Yi.Framework.Web/YiFrameworkWebModule.cs | 2 +- 5 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 src/Yi.Framework/Yi.Framework.Web/TimeTest.cs diff --git a/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj b/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj index 8abd83bd..5905072b 100644 --- a/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj +++ b/src/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj @@ -7,7 +7,12 @@ - + + + + + + diff --git a/src/Yi.Framework/Yi.Framework.Core/YiFrameworkCoreModule.cs b/src/Yi.Framework/Yi.Framework.Core/YiFrameworkCoreModule.cs index 8178b352..d5b6d357 100644 --- a/src/Yi.Framework/Yi.Framework.Core/YiFrameworkCoreModule.cs +++ b/src/Yi.Framework/Yi.Framework.Core/YiFrameworkCoreModule.cs @@ -26,7 +26,6 @@ namespace Yi.Framework.Core public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) { - //添加全局配置类 services.AddSingleton(new Appsettings(context.Configuration)); //全盘扫描,自动依赖注入 diff --git a/src/Yi.Framework/Yi.Framework.Web/Program.cs b/src/Yi.Framework/Yi.Framework.Web/Program.cs index c92b92d6..5000369f 100644 --- a/src/Yi.Framework/Yi.Framework.Web/Program.cs +++ b/src/Yi.Framework/Yi.Framework.Web/Program.cs @@ -1,7 +1,3 @@ - -using AspNetCore.Microsoft.AspNetCore.Builder; -using Autofac; -using System.Reflection; using Yi.Framework.Application; using Yi.Framework.Application.Contracts; using Yi.Framework.Core; @@ -16,7 +12,7 @@ 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("StartUrl")); @@ -50,4 +46,9 @@ var app = builder.Build(); var t = app.Services.GetService(); app.MapControllers(); + + + + + app.Run(); diff --git a/src/Yi.Framework/Yi.Framework.Web/TimeTest.cs b/src/Yi.Framework/Yi.Framework.Web/TimeTest.cs new file mode 100644 index 00000000..c8e518b2 --- /dev/null +++ b/src/Yi.Framework/Yi.Framework.Web/TimeTest.cs @@ -0,0 +1,23 @@ +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(); + Console.WriteLine($"本次运行启动时间为:{time}毫秒"); + Stopwatch.Restart(); + } + } +} diff --git a/src/Yi.Framework/Yi.Framework.Web/YiFrameworkWebModule.cs b/src/Yi.Framework/Yi.Framework.Web/YiFrameworkWebModule.cs index fba4306b..7e8267f7 100644 --- a/src/Yi.Framework/Yi.Framework.Web/YiFrameworkWebModule.cs +++ b/src/Yi.Framework/Yi.Framework.Web/YiFrameworkWebModule.cs @@ -34,7 +34,7 @@ namespace Yi.Framework.Web app.UseAuthorization(); app.UseRouting(); - + TimeTest.Result(); } }