Edit:
I've decided this is never desired behavior so I've just checked in a commit to enforce that Funq doesn't autowire string (and ValueType) properties. The new behavior will be available in the next version of ServiceStack (v3.9.34).
Existing behavior
RegisterAs is an Autowired API, i.e:
Container.RegisterAs<ConcreteDownloadServices, IDownloadServices>();
This tells ServiceStack's IOC to populate every public property with dependencies resolved by the IOC. Which because it is a string
public property will try to resolve the registered string
from the IOC. In code terms, this is happening under the hood:
new ConcreteDownloadServices {
ArbitraryProperty = Container.TryResolve<string>()
};
Which because you don't have any "string" registered will override the property with null
. Only public properties are auto-wired so you can avoid this behavior by changing it to an protected, private or internal property.
Otherwise you can override the default IOC behavior by registering a custom delegate factory which gives you full control over the construction of your dependency, e.g:
container.Register<IDownloadServices>(c => new ConcreteDownloadServices());