Skip to content

Add Container.Register(Type, Assembly, TypesToRegisterOptions) overload(s) #799

Open
@dotnetjunkie

Description

@dotnetjunkie

Batch registration sometimes requires to call the GetTypesToRegister method, which can be a hassle and this method is hard to find. Instead of using GetTypesToRegister this could be integrated in the Register method by adding one or multiple overloads that accept a TypesToRegisterOptions argument.

So instead of doing this:

var types =
    container.GetTypesToRegister(typeof(IRequestHandler<,>), assemblies,
        new TypesToRegisterOptions
	{
		IncludeGenericTypeDefinitions = true
	});

container.Register(typeof(IRequestHandler<,>), types);

We could do this:

container.Register(typeof(IRequestHandler<,>), assemblies, new TypesToRegisterOptions
{
	IncludeGenericTypeDefinitions = true
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions