public static void RegisterProperty(PropertyInfo property, HardWordAttribute attr = null) { var hw = attr ?? new HardWordAttribute(); if (!RegisteredProperties.ContainsKey(property)) { RegisteredProperties.Add(property, hw); } if (AttributeCaches.ContainsKey(property)) { AttributeCaches[property] = hw; } }
public static HardWordAttribute GetHardWordAttribute(PropertyInfo property) { HardWordAttribute attr = null; if (property != null && !AttributeCaches.TryGetValue(property, out attr)) { attr = property.GetCustomAttributes(typeof(HardWordAttribute), false).FirstOrDefault() as HardWordAttribute; if (attr == null) { RegisteredProperties.TryGetValue(property, out attr); } AttributeCaches.AddOrUpdate(property, attr, (k, v) => attr); } return(attr); }
public static void RegisterProperty <T>(Expression <Func <T, object> > propertySelector, HardWordAttribute attr = null) { var property = GetPropertyInfoFromExpression(propertySelector); RegisterProperty(property, attr); }