Skip to content

Filtering using a udf #1599

@alnotas

Description

@alnotas

Greetings everyone

I need to be able to filter a resource of mine using a udf as part of the comparison.

I have a table 'Customer' that has some fields that are encoded. I have a Db udf 'nvarchar dbo.DecryptData(byte[])' and I want to be able to write a filter like
/api/v1/customer?filter=equals(DecryptData(firstName),'Theodore')
and this to be translated in the EF Core query like
...WHERE dbo.DecryptData(firstName)='Theodore' ...

Customer.FisrtName is a varbinary field in the Db and is mapped as byte[] in my resource

Is this type of filtering possible?
I've tried by overriding the OnApplyFilter but nothing has worked so far.

VERSIONS USED
JsonApiDotNetCore version: 5.5.1
ASP.NET Core version: 8.0.6
Entity Framework Core version: 8.0.4
Database provider: SQL Server 14.0.2052.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions