Skip to content

Using a Breeze .NET server ​

Breeze talks to any server that speaks HTTP and JSON, and the rest of this section is about making it fit one. This page is about the case where you control the server too, and it is .NET: then there is a matching server library, and most of the configuration on this page disappears.

The server packages live in breeze-server-v3, and have their own documentation — see Reading the server docs.

What you get for free ​

Against a Breeze .NET server the client needs no configuration at all:

ts
import { EntityManager } from 'breeze-client';

const em = new EntityManager('/breeze/Northwind');

Every default already matches what the server does.

PieceDefaultWhy it fits
data service adapter'webApi'the request and response shapes the server produces
URI builder'json'the server reads Breeze JSON queries out of the URL
JsonResultsAdaptersupplied by the adaptermatches the $type/$ref JSON the server sends
NamingConventioncamelCasethe server sends .NET PascalCase names
metadatafetched from the servicethe server generates it from your EF or NHibernate mapping

So the pages on transport, DataServiceAdapter, JSON results and naming conventions are about other servers. You need them here only to add something of your own — auth headers, say, which is Supplying your own transport.

What the server must expose ​

Three things, at one service root:

GET {root}/Metadatathe metadata document
GET {root}/{ResourceName}one queryable endpoint per entity set
POST {root}/SaveChangesevery pending change, in one request

new EntityManager('/breeze/Northwind') sets the root; EntityQuery.from('Customers') picks the resource. On the server those are an action named Customers on a controller routed at breeze/Northwind — which is what the server's default routing produces.

Things that line up across the two sides ​

A few decisions have to match, and they are the usual source of confusion:

  • Naming. The server sends CompanyName; the client's camelCase convention makes it companyName. If the server also camel-cases its JSON, the names get translated twice and stop matching the metadata. The server's JSON serializer setup takes a camelCasing flag that defaults to false — leave it there. See Naming conventions.
  • Enums. The server can send enum values as strings or as integers. The client reads what the metadata says the property is, so the two have to agree; strings are the default on both sides.
  • Save errors. The server returns an RFC 9457 problem details document carrying per-entity errors, and the client turns those into ValidationErrors on the entities that failed. See Error handling.
  • Temporary keys. The client invents a key for a new entity; the server sends back a mapping from that to the real one, and the client swaps it everywhere — including in the foreign keys of entities saved in the same batch. Nothing to configure, but it explains why a save response changes ids.

Reading the server docs ​

The server documentation is its own site, at breeze.github.io/breeze-server-v3 — hand-written guides plus the .NET API reference, generated from the XML doc comments. What is there:

PageAbout
Getting startedfrom an empty ASP.NET Core project to a working Breeze endpoint
The PersistenceManagerthe server-side counterpart of EntityManager
Queryinghow a client's query becomes SQL, and how to bound what clients may ask for
Savingsave interceptors, transactions and key mappings
Metadatawhat the client is told about the model, and how to change it
Error handlingreturning validation and concurrency errors this client understands
API referenceevery public type in the five server packages

To build it yourself — to preview a change, or to read it offline — clone breeze-server-v3 and follow its DOCS.md.

See also ​

Released under the MIT License.