Writing document providers
Document providers are classes which implement the interface IReadsAndWritesDocument
.
You are encouraged to read the API docs for this interface.
As well as implementing this interface, a document provider is almost certain to require its own implementations of the following:
The abstractions package contains minimal abstract base classes for each of these interfaces, which cater for some of the boilerplate.
These are DocumentBase
, NodeBase
& AttributeBase
respectively.
You may use these base classes if desired, but their use is optional.
Registering/activating a document provider
In order to activate a document provider it must be added to dependency injection during start-up and it must be registered with the list of available document provider types.
Typically both of these are performed by an extension method for the IBuildsHostingEnvironment
interface.
The hosting environment builder includes an IServiceCollection
which is used to add relevant services to DI.
Here is the typical syntax for registering a document provider type:
builder.ServiceRegistry.DocumentProviderTypes
.Add(typeof(MyDocumentProvider));
Where:
builder
is theIBuildsHostingEnvironment
MyDocumentProvider
is the concrete class which implementsIReadsAndWritesDocument