Skip to content

Make all data expressions IDictionary aware (like Row) #981

Description

@RaphaelFourdrilis

Hello,

When trying to use the Update builders, I ran into some runtime exceptions stating that I was missing a Where call to make the Update builder complete, although I did have the Where call.
The problem apparently came from the fact that I gave an IDictionary<string, object> to both Set and Where methods, and it failed at runtime. I'm fairly certain that they should be able to take an IDictionary<string, object> as parameter (Just like Row does for the Insert statements). This would allow us to dynamically build such statements for when we don't know the name / values of the properties while writing the code.

For example, let's say I'm writing a generic migration class that handles updating the values of all rows in a table and I want to reuse it whatever the table is, and for whatever column of that table. The go to solution C# wise may be to use an Expression representing what column I want to transform paired with a second Expression defining the transformation to apply. This works fine until we try to give the resulting parameters to Set and Where: they both expect an anonymous type, and we don't know the property names, since they come into variables (btw, I don't even understand how one could make the difference between object and an anonymous type, since they are exactly the same, CLR wise).

So, would it be possible to have an overload for those methods (and probably all methods taking an anonymous type) taking an IDictionary<string, object> thus allowing us to use either raw dictionaries or even ExpandoObject?

Thanks for your time

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions