ASP.NET
Arch is built on the ASP.NET platform.
To get started with the Entity Api, add its NuGet package to your program, register it with the service collection, and work with its client.
NuGet Setup
Add NuGet package
TriunniaLabs.Arch.Api.Entity.Client to your project.
Note that we use our own
NuGet package feed, which you must add as a package source in your environment.
Service Setup
In the main
Service Composition section of your program startup, make the call to
AddTriunniaLabsEntityApi() to add the Entity Api.
This reads the EntityApi configuration section, registers the Entity Api client with its resilience policies, and provides a callback for its types to be registered with the message formatter.
builder.Services.AddTriunniaLabsEntityApi(builder.Configuration,
builder.Services.AddStandardMessagePackFormatters);
See:
Program.cs
Accessing the Entity Api
Access the Entity Api by injecting the
IEntityApiClient.
See
EntityApiSampleController.cs
for examples of how to use its functions. Note that all parameters passed to these functions must be
Protected Types (Protected<T>).
Generic overloads are available for strongly typed access — for example,
GetEntityDeserializedAsync<T> returns the deserialized object directly without
requiring the caller to handle MessagePack deserialization.