-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IN Claus with Vogen (ValueObjects) types #852
Comments
I´ve tested a few more scenarios and it seems that I have to explicitely use a typed collection for this case: //This works, as the List is of type RoleId
List<RoleId> ids = new List<RoleId> { RoleId.Administrator, RoleId.Manager, RoleId.User };
var test = await customQuery.Where("Id in @0", ids).ToListAsync(); //This does not work
List<string> stringIds = ids.Select(x => x.Value.ToString()).ToList();
var test = await customQuery.Where("Id in @0", stringIds).ToListAsync();
//This does not work
List<Guid> guidIds = ids.Select(x => x.Value).ToList();
var test = await customQuery.Where("Id in @0", guidIds).ToListAsync();
//This does not work
List<object> objectIds = ids.Select(x => (object)x.Value).ToList();
var test = await customQuery.Where("Id in @0", objectIds).ToListAsync();
//This does not work
string testString = string.Join(", ", ids.Select(x => $"Guid(\"{x.Value}\")"));
var test = await customQuery.Where("Id in @0", testString).ToListAsync();
Since I´m using this library in order to filter my BackEnd from FrontEnd values, I don´t have any explicit type to set for the specify for the collection. But I´m struggling to find an answer that "Id eq 'key'" works, but "@0.Contains(Id) or Id IN (@0)" does not. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.
The text was updated successfully, but these errors were encountered: