We're using ServiceStack within a package that users install onto their Umbraco website. The tricky thing is the users need to be able to add additional methods specific to their implementation.
I'm aware of the ability to pass in multiple assemblies but the issue is we can't leverage global.asax and I believe PreApplicationStartMethod needs to be compiled (so can't be changed).
Can anyone think of a way we can have an overrideable AppHost (or override the default)?
The AppHost needs to be Init, i.e.
new AppHost().Init()
within the scope of Application_Init event.As for registering services, apart from scanning the assemblies in the base constructor, you can override what services get registered by overriding AppHost.CreateServiceManager() and returning a
ServiceManager
configured with only the services you wish to support.Beyond that you can dynamically register services by using RegisterService either in your
AppHost.Configure()
or in aIPlugin
, e.g: