mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-19 13:41:24 +08:00
66926b2a36
2. 随机数辅助操作类 Util.Helpers.Random 新增 GetValues 方法, 用于从集合中随机获取指定数量子集. 3. 新增Razor页面监听服务 IRazorWatchService 及相关类型,用于监视Razor页面更改时自动生成Html文件. 4. 修复表格组件复选框,单选框,序号在有合并表头的情况下显示不正确的错误.
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Util.Aop;
|
|
using Util.Helpers;
|
|
using Util.Sessions;
|
|
using Util.Tests.Infrastructure;
|
|
using Util.Tests.UnitOfWorks;
|
|
using Xunit.DependencyInjection.Logging;
|
|
|
|
namespace Util.Data.EntityFrameworkCore {
|
|
/// <summary>
|
|
/// 启动配置
|
|
/// </summary>
|
|
public class Startup {
|
|
/// <summary>
|
|
/// 配置主机
|
|
/// </summary>
|
|
public void ConfigureHost( IHostBuilder hostBuilder ) {
|
|
Environment.SetDevelopment();
|
|
hostBuilder.ConfigureDefaults( null )
|
|
.AsBuild()
|
|
.AddAop()
|
|
.AddOracleUnitOfWork<ITestUnitOfWork, OracleUnitOfWork>( Config.GetConnectionString( "connection" ),isGuidToString:false )
|
|
.AddUtil();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 配置服务
|
|
/// </summary>
|
|
public void ConfigureServices( IServiceCollection services ) {
|
|
services.AddLogging( logBuilder => logBuilder.AddXunitOutput() );
|
|
services.AddSingleton<ISession, TestSession>();
|
|
InitDatabase( services );
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化数据库
|
|
/// </summary>
|
|
private void InitDatabase( IServiceCollection services ) {
|
|
var unitOfWork = services.BuildServiceProvider().GetService<ITestUnitOfWork>();
|
|
unitOfWork.EnsureDeleted();
|
|
unitOfWork.EnsureCreated();
|
|
}
|
|
}
|
|
}
|