Fluent API
Faster development thanks to the Fluent API of Umbraco Commerce.
An added side effect of having ReadOnly and Writable entities is that all of an entity's write operations are now performed via methods. This is instead of property setters, enabling to us convert Umbraco Commerce's write API in a fluent API.
Writing fluently
You could perform a write operation as follows:
This could be simplified further by defining these actions fluently, chaining all of the entity methods into a succinct command sequence as follows:
We know not everyone likes to write their code fluently and so the Umbraco Commerce Fluent API is an optional feature. Both code examples above are valid coding styles that will both work as well as each other. The Fluent API is an opt-in layer of syntax sugar that developers can use depending on their preferred style of coding.
Last updated