I'm trying to figure out if there is any way to create a RedisClient
that has the functionality of a RedisTypedClient
but able to define the URN key with a simple string instead of passing in a type. For example, at the moment we're creating the IRedisTypedClient like so:
var redisProjectClient = _redisClientsManager.GetClient().As<Project>()
We can then store/retrieve related entities based on types that we know about:
var files = redisProjectClient.GetRelatedEntities<File>(projectId);
However, we're wanting to manage simple JSON payloads of objects from external services (fetched by HTTP API endpoints). These payload objects will be types that we won't know about in c# but will provide schema's/type names that we want to be able to use to manage the relationships like we do in the redis typed client. I can't see if this is currently possible without having to manually manage all of the extra stuff that makes the typed clients so good:
- Id listing for entities of that type
- The ability to retrieve/update entities related to an object
GetNextSequence
for next Id
These aren't available in a flat IRedisClient
so I want to do something like this:
var file = "{...}" // JSON object provided by external service
// We will know it's a "Project" type with a "projectID" from the JSON payload data:
var redisProjectClient = _redisClientsManager.GetClient().As("Project");
redisProjectClient.StoreRelatedEntities("File", projectId, file);
// ...
var files = redisProjectClient.GetRelatedEntities("File", projectId);
Any idea if this is possible or how to create this type of client?