Giter Club home page Giter Club logo

Comments (13)

enisn avatar enisn commented on August 25, 2024 1

Thanks for reporting with the example code, I'll check it asap

from autofilterer.

enisn avatar enisn commented on August 25, 2024 1

Hand-written query expression is compiled as filter.CreateTime.Min <= Convert(x.CreateTime, Nullable'1) instead x.CreateTime >= 2023-08-12 3:17:30 PM

It's probably a Nullable check problem. I'll work on it

image

from autofilterer.

blackWins avatar blackWins commented on August 25, 2024 1

This issue occurs in sqlserver 2016

from autofilterer.

enisn avatar enisn commented on August 25, 2024

It's probably happened after PR #69

from autofilterer.

enisn avatar enisn commented on August 25, 2024

It works with SqlServer provider, can you provide me which Entity Framework provider do you use in this case?

from autofilterer.

blackWins avatar blackWins commented on August 25, 2024

SqlServer

from autofilterer.

blackWins avatar blackWins commented on August 25, 2024

abp project file

MyAbpEntityFrameworkCoreModule.cs

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddAbpDbContext<ManageDbContext>(options =>
        {
            options.AddDefaultRepositories(includeAllEntities: true);
        });
        
        context.Services.AddAbpDbContext<MyAbpDbContext>(options =>
        {
            options.AddDefaultRepositories(includeAllEntities: true);
        });

        Configure<AbpDbContextOptions>(options =>
        {
            options.UseSqlServer();
        });

    }

ManageDbContext

[ConnectionStringName("manage")]
public class ManageDbContext: AbpDbContext<ManageDbContext>
{
    public ManageDbContext(DbContextOptions<ManageDbContext> options)
        : base(options)
    {
    }

    public DbSet<ProjectInfo> ProjectInfos { get; set; }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        builder.Entity<ProjectInfo>(b =>
        {
            b.ToTable(MyAbpConsts.DbTablePrefix + "ProjectInfo");
            b.ConfigureByConvention();
        });
   }
}

ProjectInfoAppService

public class ProjectInfoAppService : CrudAppService<ProjectInfo, ProjectInfoDto, Guid, ProjectInfoGetListInput, CreateUpdateProjectInfoDto, CreateUpdateProjectInfoDto>, IProjectInfoAppService
{
    public ProjectInfoAppService(IRepository<ProjectInfo, Guid> repository) : base(repository)
    {
    }

    protected override async Task<IQueryable<ProjectInfo>> CreateFilteredQueryAsync(ProjectInfoGetListInput input)
    {
        return (await base.CreateFilteredQueryAsync(input)).ApplyFilter(input);
    }
}

from autofilterer.

blackWins avatar blackWins commented on August 25, 2024

Here's the problem .0000000

  SELECT COUNT(*)
  FROM [StockInfo] AS [s]
  WHERE CASE
      WHEN [s].[CreateTime] >= '2024-06-01T00:00:00.0000000' THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END & CASE
      WHEN [s].[CreateTime] <= '2024-06-29T00:00:00.0000000' THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END = CAST(1 AS bit)

from autofilterer.

enisn avatar enisn commented on August 25, 2024

It's generated by the EF Core provider. AutoFilterer doesn't generate SQL queries. It generates only LINQ expressions.

Does it work when you write it manually like below?

.Where(x => x.CreationTime <= DateTime.Now)

from autofilterer.

blackWins avatar blackWins commented on August 25, 2024

.Where(x => x.CreationTime <= DateTime.Now)
The execution was successful

from autofilterer.

blackWins avatar blackWins commented on August 25, 2024
    protected override async Task<IQueryable<StockInfo>> CreateFilteredQueryAsync(StockInfoGetListInput input)
    {
        return (await base.CreateFilteredQueryAsync(input))
        .Where(x => x.CreateTime > input.CreateTime.Min && x.CreateTime < input.CreateTime.Max);
        //.ApplyFilter(input);
    }

image

from autofilterer.

enisn avatar enisn commented on August 25, 2024

Which AutoFilterer version are you currently using? This has to be parameterized after PR #59

from autofilterer.

blackWins avatar blackWins commented on August 25, 2024

3.0.0

from autofilterer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.