完成种子数据模块,完成服务替换模块

This commit is contained in:
橙子
2023-01-24 13:46:22 +08:00
parent aea8b55e82
commit 4ca7b2e023
17 changed files with 173 additions and 21 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Repositories;
namespace Yi.Framework.Uow
{
internal class DefaultUnitOfWork : IUnitOfWork
{
public DefaultUnitOfWork() { }
public bool IsTran { get; set; }
public bool IsCommit { get; set; }
public bool IsClose { get; set; }
public bool Commit()
{
return true;
}
public void Dispose()
{
}
public IRepository<T> GetRepository<T>()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Uow
{
internal class DefaultUnitOfWorkManager : IUnitOfWorkManager
{
public IUnitOfWork CreateContext(bool isTran = true)
{
return new DefaultUnitOfWork();
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using StartupModules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core.Attributes;
using Yi.Framework.Ddd;
namespace Yi.Framework.Uow
{
[DependsOn(
typeof(YiFrameworkDddModule))]
public class YiFrameworkUowModule : IStartupModule
{
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
}
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
services.TryAddSingleton<IUnitOfWorkManager, DefaultUnitOfWorkManager>();
}
}
}