-
Notifications
You must be signed in to change notification settings - Fork 13
Leveling up Platform Providers
| Main > Key Concepts > Leveling up Platform Providers |
|---|
Besides abstracting technology components, Liquid also tries to get the best from all providers thus setting the service primitives (to upper application components) at the highest functionality level of them.
To follow this strategy yet being able to interchange platform components, Liquid adds some complementary code on top of the "cartridge" for a poorer featured provider so as to bring it up to the general high level of functionality.

#Example: Leveling up the abstraction of repositories
For instance of a higher functionality level that Liquid provides thanks to this strategy is the generalization of the concept of "attachments" (of documents/records) provided by Azure Cosmos DB.

Such concept allows the easy management of binary files (such as pictures, videos and documents) as objects of an aggregate root (entity). And they usually are indeed.
So Liquid encapsulates this standard abstraction of Cosmos DB as bellow:
//Injects the Repository cartridge for Azure Cosmos DB
WorkBench.UseRepository<CosmosDB>();
...
//Repository has the concept of named binary files attached to an entity
var clientPicture = await Repository.GetAttachmentAsync(clientId, "profile.jpg");
However, if one wants to use another* repository that does not provide the Attachment primitive, Liquid cartridge is complemented so as to level it up to that higher abstraction:
//Injects the Repository cartridge for AWS Dynamo DB Repository
WorkBench.UseRepository<DynamoDB>();
...
//Repository STILL has the concept of named binary files attached to an entity
var clientPicture = await Repository.GetAttachmentAsync(clientId, "profile.jpg");
Additionally, due to major storage limitations of CosmosDB for attachments, Liquid also complements CosmosDB transparently with, for instance, Azure Blob Storage:
WorkBench.UseRepository<CosmosDB>();
//Injects an external Media Storage into the Azure Cosmos DB Repository
WorkBench.UseMediaStorage<AzureBlob>();
...
//It works the SAME WAY
var clientPicture = await Repository.GetAttachmentAsync(clientId, "profile.jpg");
Finally, it is possible to work with both AWS Dynamo DB* and Azure Blob Storage as if they were a single service
WorkBench.UseRepository<DynamoDB>();
//Injects an external Media Storage into the AWS Dynamo DB Repository
WorkBench.UseMediaStorage<AzureBlob>();
...
//It works the SAME WAY
var clientPicture = await Repository.GetAttachmentAsync(clientId, "profile.jpg");
(*) Currently only CosmosDB Repository and AzureBlob MediaStorage cartridges are released. See Liquid's Roadmap for further information.