Skip to content

Dovetail Context

The joint context is the the result of collecting all the known joints for a given set of assembly. How those assemblies are collected can diff depending on on the joint context is created. Generally the joint context is created using the xref:Joinery.Dovetail.DovetailContextBuilder however you can implement your own xref:Joinery.Dovetail.IDovetailContext if you wish.

A joint context is created from a xref:Joinery.Dovetail.DovetailContextBuilder. This class is used during the bootstrapping phase of your application.

You can add joints manually, you can add them via attribute scanning, you can disable attribute scanning if you wish as well.

A context can be created from a xref:Joinery.Dovetail.DovetailContextBuilder by using DovetailContext.From.

Every joint has a category. DovetailCategory.Core is for infrastructure joints (serializers, logging), and DovetailCategory.Application is the default for everything else.

DovetailContextBuilder.Create(joints, properties, categories) takes a set of categories as well, and the context loads the joints whose category is in that set, plus the Core joints, which are always loaded. An empty set loads the Application joints and the Core joints, which is what the generated Imports.Joints() and DovetailContextBuilder.Create() pass when you give them no categories. A joint in any other category is loaded only when you name its category.

categoriesJoints in the context
[]The Application and the Core joints
[DovetailCategory.Core]Only the Core joints
[DovetailCategory.Application]The Application and the Core joints
[DovetailCategory.Core, DovetailCategory.Application]The Application and the Core joints
["Reporting"]The joints in Reporting and the Core joints, but not the Application joints

The set is available as Categories on the builder and on the context. It is the set that is loaded: the set you passed in with Core added, or Application and Core when you passed none.

Once the context is created you can use the context to find out all sorts of information.

Useful properties:

  • AssemblyProvider - The type provider can be used to get a list of assemblies
  • Properties - Contains all the properties provided to the builder. This implements IServiceProvider and can be used with `ActivatorExtensions

Useful methods / extension methods: