sunpengfei
2025-11-19 7b47c91bcf89d667a5c99cfafe0d899280f7fbe3
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;
        }
    }
}