Skip to content

IN Clause with Vogen (ValueObjects) types #852

@mkalinski93

Description

@mkalinski93

Hey,

I´m using this project in combination with EntityFramework Core and Vogen. I came across one small issue that when I´m using a .Where statement with a value object created by Vogen, the "IN" method cannot be used as the type cannot be parsed.

For example:

I need to find records that are in a list of RecordId´s.
That type is generated by Vogen and is containing a Value field with a Guid.
In Vogen, you typically create instances like that:

RoleId id = RoleId.From(Guid value);

I´ve tried these expression but with no success.

// Fails as the type does not implement with "IConvertible"
options.Filter = "id in (Guid(\"532eaef3-16c8-4ef2-b19a-d4dc122f7f15\"))";
// Fails: "Operator '==' incompatible with operand types 'RoleId' and 'String'",
options.Filter = "id in (\"532eaef3-16c8-4ef2-b19a-d4dc122f7f15\")";
// Success
options.Filter = "id eq \"532eaef3-16c8-4ef2-b19a-d4dc122f7f15\"";

I know this case is very specific and absolutely not related to this library, but I would really like to get to know if there´s something I can do to make this possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions