This repository was archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Persist and query data
Gustavo Denis edited this page Oct 31, 2019
·
1 revision
| Main > Using Liquid for building your application > Persist and query data |
|---|
Liquid adopts the Repository Pattern as a way to boost productivity, leverage JSON-native capabilities of NoSQL databases and avoid vendor lock-in.
| Take a look at related key concepts of Liquid |
|---|
| Leveling up Platform Providers |
| Encapsulated Domain Logic |
| Microservice Sizing |
Thus persisting data with Liquid is very straightforward.
Each microservice has one instance of Repository that is prepared with what was previously configured for it.
//Every microservice has at least one instance of Repository
Repository.DeleteAsync(clientId);
| See how this is done in Liquid Hotel360 sample application. |
|---|
##Storing binary data as attachments
Liquid also provides the Attachment concept for storing binary data (e.g. pictures) as attachments to structured data (e.g. client account);
ILightAttachment data = await Repository.GetAttachmentAsync(clientId, "profile.jpg");
byte[] picture = data.MediaStream.ReadAllBytes();
| See how this is done in Liquid Hotel360 sample application. |
|---|
| ##Working with additional repositories |
If for some reason a microservice needs to work with more than one repository, Liquid makes it possible and simple.
static ILightRepository otherRepo = new CosmosDB("OTHER");
...
var res = otherRepo.AddOrUpdateAsync(otherEntity);
| See how this is done in Liquid Hotel360 sample application. |
|---|