Pretty much similar to this question on SO, I am wondering what the best-practice is for automatically registering services and all the associated routes from an assembly, launched from an IPlugin Register.
In the apphost constructor you can pass a list of assemblies, but if I want to plugin-ify and let the plugin launch the service registration, what’s the best approach? Using AppHost Register requires specifying Routes, etc. There’s a nifty “AddPluginsFromAssembly” method, but no “AddServicesFromAssembly”.
Services are normally pre-registered before AppHost.Configure() gets called so you’d normally specify a list of assemblies in the AppHost constructor or by overloading CreateServiceController().
After that there’s only appHost.RegisterService<TService>(route) to register Services dynamically.
Bugger. Currently doing the first part, but I was hoping to encapsulate with plugins and let them auto register their own services, without needing to be explict about it.
Ok but that would just be a matter of going through all Service Types and registering them individually, I’ve added explicit support for this with the new IAppHost.RegisterServicesInAssembly() API in this commit.