We are using the typed client with IRedisClient.As() and the set name I guess you’d call it when stored in redis is the name of the entity (T). Does anyone know if we can specify a name to use, rather than the default auto-naming based on the entity name?
The case in point is different versions of the same object, which are different by namespace.
You can’t, it only uses the Type Name as part of the key and persists them behind the scenes in a similar approach as described in this StackOverflow answer.
You’ll need to ensure the Types used in the same Redis data store are uniquely named to avoid clashes.
The Typed Redis Client provides a high-level Typed API. If you want you can use the default string-based Redis Client, you’d be able to specify which ever key you want but you’d need to take care of serializing/deserializing it into a string (e.g. using .ToJson()).
But I’d strongly recommend against trying to save different Types with the same name and different schemas in the same datastore - you’re relying on and leaking C# namespaces out-of-process that’s bound to run into more runtime interoperability issues like this.
Thanks again for the advice mythz, I’d thought of that while looking into other things this morning but was just trying to go through the ‘can it be done easily’ and ‘is it worthwhile’ process so I can document it on our internal task.