RegisterAssemblyTypes but not PreserveExistingDefaults?

When registering types from an assembly with, RegisterAssemblyTypesI notice that it does not exist PreserveExistingDefaults, as when registering a single type.

I solved this by adding a configuration action to the registration, changing each registration to keep the default values:

var rb = builder.RegisterAssemblyTypes(...);
rb.ActivatorData.ConfigurationActions.Add((t, r) => r.PreserveExistingDefaults());

The question is that I missed some obvious function already implemented? Or should I pass the appropriate extension method to the project :)

+3
source share
1 answer

I do not think it appeared earlier - it seems that your extension is on the right track :)

+3
source

All Articles