Skip to content

Documentation (WIP)

Chris Philips edited this page Dec 4, 2022 · 3 revisions

It is auto-generated from all the XML document comments in the code base, and I plan on adding other things to it as well.


Contracts for services that can be used interact with the persistence layer in your application

Installation

dotnet add package EntityDb.Abstractions

Usage

At this time, I don't have any comments on how you should use this package. It is a dependency of every other package, and contains almost no testable code (the only exceptions being a handful of methods on value objects)

Implementations for some services which do not necessarily need to be implemented by every single application in their entirety. Additional contracts are introduced to allow for certain behaviors to work generically. The rest of the packages are build with varying degrees of dependency on this package.

Installation

dotnet add package EntityDb.Common

Preparation

Implement these interfaces:

Commands

Commands are the things you can do in your system.

Entities

Entities are the states that describe your system. Any business logic you have depends on the state of these objects

Usage

These are the objects you nee

Agents

HttpContext implementations for agents

Installation

dotnet add package EntityDb.Mvc

Usage

In your ConfigureServices method (in either Program.cs or Startup.cs), call the following extension methods on IServiceCollection serviceCollection

// This might be redundant, if your application has `IHttpContextAccessor` as a registered service.
serviceCollection.AddHttpContextAccessor();

// You can configure multiple options - they all need to be named, though
serviceCollection.Configure<HttpContextAgentSignatureOptions>("Default", (options) =>
{
    options.RedactedHeaders = new[] { "Cookie", "Authorization" };
    options.RedactedValue = "*REDACTED*";
});

// This registers the implementation of IAgentAccessor
serviceCollection.AddHttpContextAgentAccessor();

Transactions

MongoDb repository implementations for transactions

dotnet add package EntityDb.MongoDb

Postgres implementations for transactions

dotnet add package EntityDb.Npgsql

Snapshots

In-memory repository implementations for snapshots

dotnet add package EntityDb.InMemory

Other

A tool that allows you to provision certain resources for database providers, such as roles, tables/collections, and username/passwords

Installation

dotnet tool install EntityDb.Provisioner

Usage

Internal

Pretend these do not exist. If I have coded things correctly, all of the code in these packages is internal and not accessible to your application, only to the packages listed above. I just have not figured out how to make the dependent packages bundle the DLLs they need instead of depending on these packages.

  1. Json

NOTE - Right now links go to a directory in the repository. This is a placeholder for if/when a Wiki page is added that goes into more detail about that directory.