Replies: 1 comment
-
Closing this discussion. Implementation will follow in PR #603 . |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Intro
A CQL Value Tuple is basically a name-value dictionary. One would be tempted to use the dynamic ExpandoObject as a candicate for tuple types, however, the architectural decision is to avoid dynamic code in generated C#, since statically compiled code will always be more performant.
Value Tuples
C# value tuples is a good candidate, but the names of the properties are only available at compile-time. During runtime, their names are always Item1, Item2, .... etc. So this would not be idea for serialization.
Three proposals were considered and they are available in #599 .
An option is to keep the item names as part of the value tuple. The item names would have to be stored as a static property on the library, so that memory is not wasted.
Here is a code snippet demonstrating the concept
Serialization
Custom serialization is necessary, because value tuples don't serialize well as demonstrated here
Adding custom json converter
Nested Tuples
Testing more complex scenarios
Beta Was this translation helpful? Give feedback.
All reactions