Closed SerhiyBalan closed 5 months ago
There's two big problems with that, IMO:
object
So; at the worst case it could cause frustrating scenarios where problems that today are clear at build-time are deferred to runtime, and at best: it works but is unnecessarily expensive
I think I'd need a bit more "pro" to outweigh these "cons", especially since this could already be achieved in a local utility method if you really want that usage yourself
Is it possible to add a public constructor for the
RedisValue
that would acceptobject
value and automatically convert it to best possible format? RedisValue has lot of internal conversion tools, and they are not accessibleRight now I'm using the Facade pattern with methods like
Similar for other data types like Hash
In both cases I had to use extensions to convert data:
Another option is to write code like
There are would be lot of ifs, because StackExchange.Redis has lot of internal convertors :(
The
ToObject
has similar code but from RedisValue to T.So I would be interested in come
public RedisValue(object value)
that would try to detect best matching target format, or serialize the string if not possible.And some method like
ConvertTo
Thank you