I create a great service and use Ninjcet:
Bind<IMyObject>().To<MyObject>();
Since my logic level is quite large and will grow, I would like to automatically create bindings in the assembly, given that the class implements the interface.
public void LoadAssembly() { string[] files = Directory.GetFiles(binFolder, "Logic.dll", SearchOption.AllDirectories); foreach (var file in files) { var fileName = Path.GetFileName(file); if (fileName != null && fileName.Contains("Logic")) { DynamicallyBindManagers(Assembly.LoadFrom(file)); } } } private void DynamicallyBindManagers(Assembly assembly) { var classes = FindClassesWithInterfacesInAssembly(assembly);
All help was appreciated.
source share