Definition

Assembly: CloudNimble.DotNetDocs.Core.dll Namespace: Microsoft.Extensions.DependencyInjection Inheritance: System.Object

Syntax

Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions

Summary

Extension methods for registering DotNetDocs services with dependency injection.

Methods

AddDocEnricher

Adds a custom document enricher to the service collection.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDocEnricher<TEnricher>(Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TEnricher : class, CloudNimble.DotNetDocs.Core.IDocEnricher

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Type Parameters

  • TEnricher - The type of enricher to add.

Examples

services.AddDocEnricher&lt;ConceptualContentEnricher&gt;();

Remarks

Registers the enricher as Scoped implementation of IDocEnricher. Enrichers add conceptual content to documentation entities.

AddDocRenderer

Adds a custom document renderer to the service collection.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDocRenderer<TRenderer>(Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TRenderer : class, CloudNimble.DotNetDocs.Core.IDocRenderer

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Type Parameters

  • TRenderer - The type of renderer to add.

Examples

services.AddDocRenderer&lt;MyCustomRenderer&gt;();

Remarks

Registers the renderer as Scoped implementation of IDocRenderer.

AddDocTransformer

Adds a custom document transformer to the service collection.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDocTransformer<TTransformer>(Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TTransformer : class, CloudNimble.DotNetDocs.Core.IDocTransformer

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Type Parameters

  • TTransformer - The type of transformer to add.

Examples

services.AddDocTransformer&lt;InheritDocTransformer&gt;();

Remarks

Registers the transformer as Scoped implementation of IDocTransformer. Transformers modify the documentation model before rendering.

AddDotNetDocs

Adds DotNetDocs services with all built-in renderers to the service collection.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDotNetDocs(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.ProjectContext> configureContext = null)

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.
configureContextSystem.Action<CloudNimble.DotNetDocs.Core.ProjectContext>?Optional action to configure the ProjectContext.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Examples

services.AddDotNetDocs(context =&gt;
{
    context.OutputPath = "docs/api";
    context.ShowPlaceholders = false;
});

Remarks

This method registers:
  • ProjectContext as Singleton
  • DocumentationManager as Scoped
  • All built-in renderers (Markdown, JSON, YAML) as Scoped
  • MarkdownXmlTransformer for processing XML documentation tags

AddDotNetDocsCore

Adds only the core DotNetDocs services without any renderers.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDotNetDocsCore(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.ProjectContext> configureContext = null)

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.
configureContextSystem.Action<CloudNimble.DotNetDocs.Core.ProjectContext>?Optional action to configure the ProjectContext.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Examples

services.AddDotNetDocsCore(context =&gt;
{
    context.OutputPath = "docs";
});
services.AddMarkdownRenderer();

Remarks

Use this method when you want to manually register specific renderers. This registers:
  • ProjectContext as Singleton
  • DocumentationManager as Scoped

AddDotNetDocsPipeline

Adds DotNetDocs services using a fluent pipeline builder.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDotNetDocsPipeline(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.Configuration.DotNetDocsBuilder> configurePipeline)

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.
configurePipelineSystem.Action<CloudNimble.DotNetDocs.Core.Configuration.DotNetDocsBuilder>Action to configure the documentation pipeline.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Examples

services.AddDotNetDocsPipeline(pipeline =&gt;
{
    pipeline
        .UseMarkdownRenderer()
        .UseJsonRenderer(options =&gt; options.WriteIndented = true)
        .AddEnricher&lt;MyCustomEnricher&gt;()
        .ConfigureContext(ctx =&gt; ctx.OutputPath = "docs");
});

AddJsonRenderer

Adds the JSON renderer to the service collection.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddJsonRenderer(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.Renderers.JsonRendererOptions> configureOptions = null)

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.
configureOptionsSystem.Action<CloudNimble.DotNetDocs.Core.Renderers.JsonRendererOptions>?Optional action to configure JsonRendererOptions.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Examples

services.AddJsonRenderer(options =&gt;
{
    options.WriteIndented = true;
    options.IncludeNullValues = false;
});

Remarks

Registers JsonRenderer as Scoped implementation of IDocRenderer.

AddMarkdownRenderer

Adds the Markdown renderer to the service collection.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMarkdownRenderer(Microsoft.Extensions.DependencyInjection.IServiceCollection services)

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Remarks

Registers MarkdownRenderer as Scoped implementation of IDocRenderer. Also registers MarkdownXmlTransformer to process XML documentation tags.

AddYamlRenderer

Adds the YAML renderer to the service collection.

Syntax

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddYamlRenderer(Microsoft.Extensions.DependencyInjection.IServiceCollection services)

Parameters

NameTypeDescription
servicesMicrosoft.Extensions.DependencyInjection.IServiceCollectionThe service collection.

Returns

Type: Microsoft.Extensions.DependencyInjection.IServiceCollection The service collection for chaining.

Remarks

Registers YamlRenderer as Scoped implementation of IDocRenderer.