mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 01:05:27 +08:00 
			
		
		
		
	- 修复 多表 ToList 非 a,b,c 别名相同实体 bug;#1830 #1861
This commit is contained in:
		@@ -480,6 +480,13 @@
 | 
			
		||||
            FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString}
 | 
			
		||||
            </summary>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="M:FreeSql.IRepositoryUnitOfWork.GetRepository``1">
 | 
			
		||||
            <summary>
 | 
			
		||||
            在工作单元内创建联合主键的仓储类,工作单元下的仓储操作具有事务特点
 | 
			
		||||
            </summary>
 | 
			
		||||
            <typeparam name="TEntity"></typeparam>
 | 
			
		||||
            <returns></returns>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="M:FreeSql.IBaseRepository.AsType(System.Type)">
 | 
			
		||||
            <summary>
 | 
			
		||||
            动态Type,在使用 Repository<object> 后使用本方法,指定实体类型
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user