/// <summary> /// Registers the controller in the engine. /// </summary> /// <param name="info">The controller descriptor.</param> public void RegisterController(IMethodsControllerDesc info) { List<string> newBindUrls = new List<string>(); foreach (IMethodsBindPointDesc bindPoint in info.Targets) { List<IMethodsBindPointDesc> descriptors; //Manually written "?" at the end of binding indicates that there whould be //at least one item on this position. //In this case we replace "?" with "?/*". if (bindPoint.Target.EndsWith("?")) descriptors = RegisterBindPointTarget(newBindUrls, bindPoint.Target.Remove(bindPoint.Target.Length - 1).Insert(bindPoint.Target.Length - 1, "*/?")); else //common case descriptors = RegisterBindPointTarget(newBindUrls, bindPoint.Target); int i = 0; foreach (IMethodsBindPointDesc comparedBindPoint in descriptors) { if (comparedBindPoint.Priority > bindPoint.Priority) break; i++; } descriptors.Insert(i, bindPoint); } foreach (string bindUrl in newBindUrls) { processor.AddNewBinding(bindUrl); } }
/// <summary> /// Registers the controller in the engine. /// </summary> /// <param name="info">The controller descriptor.</param> public void RegisterController(IMethodsControllerDesc info) { List<string> newBindUrls = new List<string>(); foreach (IMethodsBindPointDesc bindPoint in info.Targets) { List<IMethodsBindPointDesc> descriptors = null; if (!map.TryGetValue(bindPoint.Target, out descriptors)) { descriptors = new List<IMethodsBindPointDesc>(); map.Add(bindPoint.Target, descriptors); newBindUrls.Add(bindPoint.Target); } int i = 0; foreach (IMethodsBindPointDesc comparedBindPoint in descriptors) { if (comparedBindPoint.Priority > bindPoint.Priority) break; i++; } descriptors.Insert(i, bindPoint); } foreach (string bindUrl in newBindUrls) { processor.AddNewBinding(bindUrl); } }