Skip to content

Latest commit

 

History

History
106 lines (89 loc) · 4.31 KB

File metadata and controls

106 lines (89 loc) · 4.31 KB

Microsoft.Extensions.DependencyInjection


ApplicationInsightsExtensions

Extension methods for configuring Application Insights telemetry.

public static class ApplicationInsightsExtensions

Static Methods

AddCallingIdentityTelemetryInitializer

IServiceCollection AddCallingIdentityTelemetryInitializer(this IServiceCollection services)

Summary: Registers telemetry initializers for enriching Application Insights telemetry with request context information.

Parameters:
     services  -  The service collection.

Returns: The service collection for method chaining.

Remarks: This method registers the following telemetry initializers: Microsoft.ApplicationInsights.Extensibility.CallingIdentityTelemetryInitializer - Adds calling identity and request correlation IDs to telemetry.Microsoft.ApplicationInsights.Extensibility.Accept4xxResponseAsSuccessInitializer - Treats certain 4xx responses (BadRequest, NotFound) as successful requests.


RestApiExtensions

Extension methods for configuring REST API services in the dependency injection container.

public static class RestApiExtensions

Static Methods

AddRestApi

IServiceCollection AddRestApi(this IServiceCollection services)

Summary: Registers REST API services with default configuration options.

Parameters:
     services  -  The service collection.

Returns: The service collection for method chaining.

AddRestApi

IServiceCollection AddRestApi(this IServiceCollection services, RestApiOptions restApiOptions)

Summary: Registers REST API services with default configuration options.

Parameters:
     services  -  The service collection.

Returns: The service collection for method chaining.

AddRestApi

IServiceCollection AddRestApi(this IServiceCollection services, Action<IMvcBuilder> setupMvcAction, RestApiOptions restApiOptions)

Summary: Registers REST API services with default configuration options.

Parameters:
     services  -  The service collection.

Returns: The service collection for method chaining.


ServiceCollectionExtensions

Extension methods for Microsoft.Extensions.DependencyInjection.IServiceCollection to auto-register and validate service registrations.

public static class ServiceCollectionExtensions

Static Methods

AutoRegistrateServices

void AutoRegistrateServices(this IServiceCollection services, Assembly interfaceAssembly, Assembly implementationAssembly)

Summary: Automatically registers services by matching interfaces from one assembly with implementations from another.

Parameters:
     services  -  The service collection.
     interfaceAssembly  -  The assembly containing service interfaces.
     implementationAssembly  -  The assembly containing service implementations.

Remarks: This method scans both assemblies and registers each interface with its matching implementation as a transient service. Only the first matching implementation for each interface is registered.

ValidateServiceRegistrations

void ValidateServiceRegistrations(this IServiceCollection services, Assembly apiAssembly)

Summary: Validates that all interfaces in the specified assembly have been registered in the service collection.

Parameters:
     services  -  The service collection.
     apiAssembly  -  The assembly containing interfaces to validate.


Generated by MarkdownCodeDoc version 1.2