0

1)IStudyService studyService3 = ServiceLocator.Current.GetInstance(); What would be the StructureMap.IContext.RequestedName in the above call , when we go with empty key? Will it be null or wmpty?

Key Note: IStudyService studyService2 = ServiceLocator.Current.GetInstance"localhost"); In the above condition StructureMap.IContext.RequestedName will be "localhost" which was given as key.

But in the first condition what would be the RequestedName?

The question is raised due to this below situation

If(context =>

  {
    return (String.IsNullOrEmpty(context.RequestedName) ||
      context.RequestedName.Equals("localhost", StringComparison.OrdinalIgnoreCase) ||
  }).

when we are checking the context.RequestedName with null or empty the above check fails as i mentioned earlier.

Thanks in advance

Regards Sukumar

1 Answers1

0

In case when you are not providing instanceKey context.RequestedName would be "DEFAULT".

LetMeCodeThis
  • 591
  • 6
  • 10