using OpenHarbor.CQRS.DynamicQuery.Abstractions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CH.Dal; public class DefaultQueryableProvider(CHDbContext dbContext, IServiceProvider serviceProvider) : IQueryableProvider where TEntity : class { public Task> GetQueryableAsync(object query, CancellationToken cancellationToken = default) { if (serviceProvider.GetService(typeof(IQueryableProviderOverride)) is IQueryableProviderOverride queryableProviderOverride) return queryableProviderOverride.GetQueryableAsync(query, cancellationToken); return Task.FromResult(dbContext.Set().AsQueryable()); } }