This project is read-only.

HttpHostConfiguration pattern too inflexible

Topics: Web Api
May 16, 2011 at 12:45 AM
The built-in configuration factory follows a pattern where the properties (such as InstanceFactory) are readonly (internal set) and the fluent setters (i.e. SetResourceFactory<T>) require the T to have a public default constructor (new() constraint).

This seems unnecessarily limiting. I cannot provide a ready-built resource factory (i.e. with some external dependencies already built-in) in any way, unless I go and implement the entire IHttpHostConfigurationBuilder interface.

The setter for the properties should be at least protected internal set, so that from a custom configuration I can set the property to an instantiated value.

Concrete case: I'm creating an AutofacResourceFactory, which needs the IContainer to pull instances from.

Maybe I'm just missing something obvious :)


Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471