Table of Contents

Property RegisterGenericHandlers

Namespace
Mediarion
Assembly
Mediarion.Extensions.DependencyInjection.dll

RegisterGenericHandlers

Gets or sets whether open generic handlers are closed over the scanned types and registered. Off by default.

public bool RegisterGenericHandlers { get; set; }

Property Value

bool

Remarks

A container cannot register an open generic handler: it closes an open implementation against an open service type by matching type parameters position for position, and a handler's do not line up. Turning this on does the closing at registration instead, one concrete handler per candidate type, which is what the other library's flag of the same name does.

Candidates are the concrete types of the assemblies being scanned, so Wrapped<Order> finds a handler and Wrapped<int> does not. That is the other library's behaviour as well, and it is the only way the set is finite.

Off by default because it is a cross product: it can register a great many services, and the cost would land on every application that never wrote a generic handler.