sunpengfei
2025-11-19 a62b3247a44963907a7f84c4d1de87fc8bd5d718
ApiTools.Core/Utils/CollectionUtils/CollectionUtils.cs
@@ -1,4 +1,6 @@
using System;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
@@ -69,5 +71,28 @@
        {
            return !list.IsNull();
        }
        public static IQueryable<TEntity> GetQueryable<TEntity, TDbContextLocator>(this IRepository<TEntity, TDbContextLocator> rep, bool noTracking = true)
            where TEntity : class, IPrivateEntity, new()
            where TDbContextLocator : class, IDbContextLocator
        {
            var q = rep.AsQueryable();
            if (noTracking)
            {
                q = q.AsNoTracking();
            }
            return q;
        }
        public static IQueryable<TEntity> GetQueryable<TEntity>(this IRepository<TEntity> rep, bool noTracking = true)
            where TEntity : class, IPrivateEntity, new()
        {
            var q = rep.AsQueryable();
            if (noTracking)
            {
                q = q.AsNoTracking();
            }
            return q;
        }
    }
}