Found this - Autofac register and resolve with Names, but I need it to be more dynamic
I have a library, where a lot of new classes will be added. Let's call them NewClass1, NewClass2, etc., and all these classes inherit AbstractBaseClass abstract class.
builder.RegisterAssemblyTypes(libraryAssembly)
.Where(t => t.IsSubclassOf(typeof(AbstractBaseClass)));
I am able to resolve NewClass1/2/3/... like this
container.Resolve<NewClass1>()
but I need to specify the class name myself, and it cannot be a string name of the class.
Any pointers anyone? I am looking for something like,
container.Resolve("NewClass1")
// or
container.Resolve("NewClass2")
TIA