You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I´m working on a project, which heavily uses Vogen, that needs to filter values submitted by the FrontEnd, on the BackEnd with IQueryable.
I would say that 95% of the cases are doing great and I´m enjoying the work with Vogen so far.
Now I´ve encountered one specific type of problem that is drastically putting me into the corner.
I need to filter values with a "Contains" or "IN" operation. For example, I have a List of Guid/string supplied from the frontEnd that needs to filter the property 'Id: UserId' (that´s my ValueObject here). I will receive the property name "id" and a collection of Guid/String values.
The real problem starts here: Whenever I "dynamically" want to filter the database, I have limited choices:
Use a custom library that parses strings into Expression - like Gridify, Dynamic.LINQ and so on
Implement my own library - I´m not scared of
Implement some sort of "EF.Property" butchery - not a fan of
But all three choices brought me back to a single point of failure - Type safety.
If the QueryFilter object doesn´t explicitely contains the type of UserId, either as an object or as a generic collection, I´m done. I would need to explicitely specify the type, otherwise EfCore cannot work with it.
Whenever I try to provide some sort of "dynamic filter", the ValueConverter of EfCore will be in charge, converting the values back and forth (Primitive <-> ValueObject) and I cannot use primitive types from the request as it expects the real ValueObject with correct type. The result will always be empty. And it makes sense. Now, after a few days of pain, I finally want to reliefe myself and write down this question. Is there anybody here, that has found a solution to it?
The text was updated successfully, but these errors were encountered:
Describe the feature
Hello,
I´m working on a project, which heavily uses Vogen, that needs to filter values submitted by the FrontEnd, on the BackEnd with IQueryable.
I would say that 95% of the cases are doing great and I´m enjoying the work with Vogen so far.
Now I´ve encountered one specific type of problem that is drastically putting me into the corner.
I need to filter values with a "Contains" or "IN" operation. For example, I have a List of Guid/string supplied from the frontEnd that needs to filter the property 'Id: UserId' (that´s my ValueObject here). I will receive the property name "id" and a collection of Guid/String values.
The real problem starts here: Whenever I "dynamically" want to filter the database, I have limited choices:
But all three choices brought me back to a single point of failure - Type safety.
If the QueryFilter object doesn´t explicitely contains the type of UserId, either as an object or as a generic collection, I´m done. I would need to explicitely specify the type, otherwise EfCore cannot work with it.
Whenever I try to provide some sort of "dynamic filter", the ValueConverter of EfCore will be in charge, converting the values back and forth (Primitive <-> ValueObject) and I cannot use primitive types from the request as it expects the real ValueObject with correct type. The result will always be empty. And it makes sense. Now, after a few days of pain, I finally want to reliefe myself and write down this question. Is there anybody here, that has found a solution to it?
The text was updated successfully, but these errors were encountered: