public virtual string Resolve <T>(IContext context) { string key = string.Empty; string modelName = GetModelTypename <T>(); string applicationContext = context.ApplicationContextKey; string namespaceString; if (!String.IsNullOrWhiteSpace(applicationContext) && !String.IsNullOrWhiteSpace(modelName)) { string mapkey = String.Format("{0}:{1}", applicationContext, modelName); if (!maps.ContainsKey(mapkey)) { bool b = false; for (int i = 0; !b && i < group.Sections.Count; i++) { eXtensibleStrategySection section = group.Sections[i] as eXtensibleStrategySection; if (section.Context.Equals(applicationContext, System.StringComparison.OrdinalIgnoreCase)) { key = section.DefaultResolution; for (int j = 0; !b && j < section.Strategies.Count; j++) { eXtensibleStrategyElement element = section.Strategies[j] as eXtensibleStrategyElement; if (element.StrategyValue.Equals(modelName, StringComparison.OrdinalIgnoreCase)) { key = element.Resolution; b = true; } } if (!b && ParseNamespace(modelName, out namespaceString)) { for (int j = 0; !b && j < section.Strategies.Count; j++) { eXtensibleStrategyElement element = section.Strategies[j] as eXtensibleStrategyElement; if (element.StrategyValue.Equals(namespaceString, StringComparison.OrdinalIgnoreCase)) { key = element.Resolution; b = true; } } } b = true; } } maps.TryAdd(mapkey, key); } else { maps.TryGetValue(mapkey, out key); } } return(key); }
public bool ContainsSectionContext(string name, out eXtensibleStrategySection found) { bool b = false; found = null; for (int i = 0; !b && i < this.Sections.Count; i++) { eXtensibleStrategySection section = this.Sections[i] as eXtensibleStrategySection; if (section.Context.Equals(name, StringComparison.OrdinalIgnoreCase)) { found = section; b = true; } } return b; }
public bool ContainsSectionContext(string name, out eXtensibleStrategySection found) { bool b = false; found = null; for (int i = 0; !b && i < this.Sections.Count; i++) { eXtensibleStrategySection section = this.Sections[i] as eXtensibleStrategySection; if (section.Context.Equals(name, StringComparison.OrdinalIgnoreCase)) { found = section; b = true; } } return(b); }