启动时间测试
This commit is contained in:
@@ -7,7 +7,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Module\" />
|
||||
<Compile Remove="Module\**" />
|
||||
<EmbeddedResource Remove="Module\**" />
|
||||
<None Remove="Module\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Options\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace Yi.Framework.Core
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
|
||||
//添加全局配置类
|
||||
services.AddSingleton(new Appsettings(context.Configuration));
|
||||
//全盘扫描,自动依赖注入
|
||||
|
||||
@@ -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<string>("StartUrl"));
|
||||
@@ -50,4 +46,9 @@ var app = builder.Build();
|
||||
|
||||
var t = app.Services.GetService<Test2Entity>();
|
||||
app.MapControllers();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
app.Run();
|
||||
|
||||
23
src/Yi.Framework/Yi.Framework.Web/TimeTest.cs
Normal file
23
src/Yi.Framework/Yi.Framework.Web/TimeTest.cs
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace Yi.Framework.Web
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
TimeTest.Result();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user