What is Breeze?
Breeze is a TypeScript library for client applications that work with a lot of related data: applications where users search, view, add, change and delete records, and where the data forms a graph — customers with orders, orders with line items, line items with products.
Breeze keeps that data in a client-side cache of entities. You query a service, Breeze turns the JSON it gets back into entities, and from then on it tracks what you do to them. When you are ready, you send every change back in one request.
Breeze 3 does not depend on any UI framework. It works the same way in a React, Vue, Angular, Svelte or plain TypeScript application, and in Node. There are guides for Angular and React.
What it does
Queries
- A fluent query API:
where,orderBy,skip,take,expand,select. - Simple conditions (
freight > 100), compound conditions (and,or,not), functions (toUpper,substring,length, …), and conditions on related entities withanyandall. expandbrings related entities back in the same response.selectprojects a subset of properties, or flattens a graph.- Query results are merged into the cache. Entities you have changed but not saved keep your changes by default.
- The same query object can run against the local cache instead of the server.
See Querying.
Caching
- Every entity a query returns, and every entity you create, goes into the cache of an
EntityManager. - Navigation properties connect cached entities to each other:
Customer→orders→orderDetails→product, and back again. - You can use several managers side by side, for example to isolate an edit session from the main cache.
- A cache can be exported to a string and imported again later, which is useful for offline scenarios.
See EntityManager and caching and Export and import.
Change tracking
- Each entity knows whether it is new, modified, marked for deletion or unchanged, and remembers its original values.
- One call reverts an entity, or the whole cache, to its original values.
- Events report property changes, state changes, and entities entering or leaving the cache.
See Change tracking and Inside the entity.
Validation
- Validation rules come from metadata (required, maximum length, data type) and from validators you add yourself, at property or entity level.
- Validation runs automatically, when you attach an entity, when you change a property and before you save. You can also run it on demand.
- Validation messages are templates, so you can replace or localize them.
See Validation.
Saving
saveChanges()sends every pending add, update and delete in one request, and the server applies them in one transaction.- One save can include entities of different types.
- Keys generated by the server replace the client's temporary keys, and every foreign key that referred to them is updated.
- Metadata marks the concurrency properties, so the server can detect optimistic concurrency conflicts.
See Saving changes.
Metadata-driven entities
- Entity types, keys, relationships and validation rules are described by metadata. You can fetch the metadata from the server, write it by hand, or both.
- Breeze builds entities from the metadata, so you do not have to write model classes. You can write them if you want to add behaviour.
- Entities can have complex-type properties.
See Metadata and Extending entities.
What it talks to
Out of the box, Breeze talks to a Breeze .NET server: ASP.NET Core with Entity Framework Core or NHibernate, using the breeze-server-v3 packages. That server supplies the metadata, runs the queries and applies the saves.
The adapters are replaceable. To talk to a different backend, write a data service adapter — see Talking to the server and DataServiceAdapter. To route HTTP through your own code, supply a fetch function — see Supplying your own transport.
Next
Getting started installs Breeze, configures it and runs a first query.