Usage
As a quick introduction, the main methods provided by Cascade for applications are :
var product = await cascade.Create<Product>(new Product() { colour = "Red" });
var product = await cascade.Get<Product>(25, populate: new string[] { nameof(Product.Manufacturer) });
var redThings = await cascade.Query<Product>("red_products",new JsonObject { ["colour"] = "red" });
var updated = await cascade.Update(product, new JsonObject { ["colour"] = "red" });
await cascade.Destroy(product);
var promoted = await cascade.Execute("PROMOTE",new JsonObject { ["product_id"] = 25 })
await cascade.Populate(product,new string[] { nameof(Product.Manufacturer),nameof(Product.Category) })
For details see Cascade API Reference
Application Requirements :
- Using the SuperModel base class and its attributes for all application models
- Implementing an origin class for your server(s) API
- Constructing an instance of CascadeDataLayer with the desired cache layer(s) and origin
- Using the CascadeDataLayer for application server interactions
- As for any application that needs to create records offline, you should probably use GUID ids
Features
- “freshness” option to determine whether to get data from either a cache or the server
- “fallback freshness” option to silently fallback to a cached data when unable to reach the server
- “hold” option to mark retrieved records for downloading and preservation offline even when caches are cleared