私はIOCコンテナの使用を検討していますが、従来のコードで作業しています。どこにでも CreateInstance
のロードがあり、そのクラスで完了したことがあります。
Is there a way I can get a IOC container to return a list of classes it has instantiated so the methods currently in use can continue doing their thing just without the CreateInstance
For example Autofac will scan an assembly/set of assemblies with code similar to the below, I was just wondering if it can return a List
of the classes it has created.
var dataAccess = Assembly.GetExecutingAssembly();
builder.RegisterAssemblyTypes(dataAccess)
.Where(t => t.Name.EndsWith("Repository"))
.AsImplementedInterfaces();
UPDATE: I'm just deciding on which IOC to use but need the above functionality to tell me at what classes have been instantiated.