ObjectFactory.Initialize(x =>
{
x.ForRequestedType<IFarmManager>().TheDefault.Is.Object(null);
};
但是,运行时会引发ArgumentNullException:
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
是否可以使用null作为接口的默认实例?
我知道这个问题:
StructureMap and passing null parameter to instance
但它没有任何答案。