Alexander Notas
Alexander Notas

Reputation: 11

JsonApiDotNetCore and filtering using a udf

I am using JsonApiDotNetCore, .NET Core, and EF Core on SQL Server and creating a REST project implementing the Json API standard.

I have plenty of resources (models) but one of them has some fields that are encoded.

For example, I have a table Customers that has columns that are encoded using a DB symmetric key (not important here).

I have a database user-defined function

nvarchar dbo.DecryptData(byte[])

that performs the decryption of these columns and I want to be able to write a JSON API filter like this:

/api/v1/customer?filter=equals(DecryptData(firstName), 'Theodore')

and this to be translated in the EF Core query like

WHERE dbo.DecryptData(firstName) = 'Theodore'

Customers.FirstName is a varbinary column in the database and is mapped as byte[] in my resource

Is this type of filtering possible?

I've tried several suggestions for CoPilot/ChatGpt by overriding the OnApplyFilter but nothing has worked so far.

Any ideas?

Upvotes: 1

Views: 78

Answers (0)

Related Questions