public static bool TryGetBinder(string prefix, out IPDFBindingExpressionFactory binder) { GenerationConfigurationSection section = GeneratorSection; if (null == section) { binder = null; return(false); } BindingFactoryElementCollection col = section.ExpressionBinders; BindingFactoryElement ele = null; if (col == null || col.Count == 0) { binder = null; return(false); } else if (col.TryGetBindingElement(prefix, out ele)) { binder = ele.GetFactory(); return(null != binder); } else { binder = null; return(false); } }
/// <summary> /// Attepts to retrieve any configured BindingFactoryElement based on the provided prefix. Returns true if one is defined, otherwise false /// </summary> /// <param name="prefix"></param> /// <param name="element"></param> /// <returns></returns> public bool TryGetBindingElement(string prefix, out BindingFactoryElement element) { if (this.Count > 0) { element = this.BaseGet(prefix) as BindingFactoryElement; } else { element = null; } return(null != element); }
/// <summary> /// Overrides the abstract base method to return the BindingPrefix of the BindingFactoryElement config element /// </summary> /// <param name="element">Must be an instance of BindingFactoryElement</param> /// <returns></returns> protected override object GetElementKey(ConfigurationElement element) { BindingFactoryElement bind = (BindingFactoryElement)element; return(bind.BindingPrefix); }