private void ReadScope(XElement element, BindingBuilder<object> builder) { XAttribute scopeAttribute = element.Attribute("scope"); if (scopeAttribute == null || String.IsNullOrEmpty(scopeAttribute.Value)) { builder.InTransientScope(); return; } string value = scopeAttribute.Value.ToLower(); switch (value) { case "transient": builder.InTransientScope(); break; case "singleton": builder.InSingletonScope(); break; case "thread": builder.InThreadScope(); break; case "request": builder.InRequestScope(); break; default: throw new ConfigurationErrorsException(String.Format("The 'bind' element has an unknown value '{0}' for its 'scope' attribute. Valid values are transient, singleton, thread, and request.", value)); } }