public void Bind(PropertyInfo property, IBindingContext context) { property.ForAttribute<BindingAttribute>(att => { att.Bind(property, context); }); }
public static string ToFlagName(PropertyInfo property) { var name = property.Name.Substring(0, property.Name.Length - 4); property.ForAttribute<FlagAliasAttribute>(att => name = att.Alias); return FLAG_PREFIX + name.ToLower(); }
public static FlagAliases ToFlagAliases(PropertyInfo property) { var name = property.Name; if (name.EndsWith("Flag")) { name = name.Substring(0, property.Name.Length - 4); } name = splitOnPascalCaseAndAddHyphens(name); var oneLetterName = name.ToLower()[0]; property.ForAttribute<FlagAliasAttribute>(att => { name = att.LongAlias ?? name; oneLetterName = att.OneLetterAlias ?? oneLetterName; }); return new FlagAliases { ShortForm = (SHORT_FLAG_PREFIX + oneLetterName), LongForm = LONG_FLAG_PREFIX + name.ToLower() }; }