- 修复 多表 ToList 非 a,b,c 别名相同实体 bug;#1830 #1861

This commit is contained in:
2881099
2024-07-25 01:00:56 +08:00
parent b024c54d01
commit 04a538ab42
5 changed files with 63 additions and 2 deletions

View File

@ -0,0 +1,31 @@
using System;
using System.Linq.Expressions;
namespace FreeSql
{
public interface IRepositoryUnitOfWork : IUnitOfWork
{
/// <summary>
/// 在工作单元内创建联合主键的仓储类,工作单元下的仓储操作具有事务特点
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <returns></returns>
IBaseRepository<TEntity> GetRepository<TEntity>() where TEntity : class;
}
class RepositoryUnitOfWork : UnitOfWork, IRepositoryUnitOfWork
{
public RepositoryUnitOfWork(IFreeSql fsql) : base(fsql)
{
}
public IBaseRepository<TEntity> GetRepository<TEntity>() where TEntity : class
{
var repo = new DefaultRepository<TEntity, int>(_fsql);
repo.UnitOfWork = this;
return repo;
}
}
}