C# StructureMap.IContext.RequestedName?
1) IStudyService studyService3=ServiceLocator.Current.GetInstance(); 当我们使用空键时,上述调用中的StructureMap.IContext.RequestedName是什么? 它是null还是wmpty 关键提示: IStudyService studyService2=ServiceLocator.Current.GetInstance“localhost”); 在上述条件下,StructureMap.IContext.RequestedName将是作为键提供的“localhost” 但是在第一种情况下,请求的名称是什么 由于以下情况,提出了这个问题 如果(上下文=>C# StructureMap.IContext.RequestedName?,c#,asp.net,linq,structuremap,service-locator,C#,Asp.net,Linq,Structuremap,Service Locator,1) IStudyService studyService3=ServiceLocator.Current.GetInstance(); 当我们使用空键时,上述调用中的StructureMap.IContext.RequestedName是什么? 它是null还是wmpty 关键提示: IStudyService studyService2=ServiceLocator.Current.GetInstance“localhost”); 在上述条件下,StructureMap.IContext.R
{
return (String.IsNullOrEmpty(context.RequestedName) ||
context.RequestedName.Equals("localhost", StringComparison.OrdinalIgnoreCase) ||
}).
当我们检查context.RequestedName为null或为空时,如上所述,上述检查将失败
提前谢谢
问候
Sukumar以防您不提供instanceKey
上下文。RequestedName
将是“默认值”