I'd like to pass null as the default instance of my IFarmManager class using StructureMap. I've currently got the following in my Global.asax:
ObjectFactory.Initialize(x =>
{
x.ForRequestedType<IFarmManager>().TheDefault.Is.Object(null);
};
However, an ArgumentNullException is thrown at runtime:
Value cannot be null.
Parameter name: anObject
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: anObject
Is it possible to use null as the default instance for an Interface?
I'm aware of this question: http://stackoverflow.com/questions/1229779/structuremap-and-passing-null-parameter-to-instance but it doesn't have any answers.