public static void RegisterEntityLinks <T>(Func <Lite <T>, Control, QuickLink[]> getQuickLinks) where T : Entity { var current = EntityLinks.GetDefinition(typeof(T)); current += (t, p0) => getQuickLinks((Lite <T>)t, p0); EntityLinks.SetDefinition(typeof(T), current); }
static void GenerateType <T>() where T : ModifiableEntity { if (validators.GetDefinition(typeof(T)) != null) { return; } if (typeof(T) != typeof(ModifiableEntity)) { GenerateType(typeof(T).BaseType); } var dic = (from pi in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly) where !Attribute.IsDefined(pi, typeof(HiddenPropertyAttribute)) select KVP.Create(pi.Name, (IPropertyValidator) new PropertyValidator <T>(pi))).ToDictionary(); validators.SetDefinition(typeof(T), dic); }
static void GenerateType <T>() where T : ModifiableEntity { if (validators.GetDefinition(typeof(T)) != null) { return; } if (typeof(T) != typeof(ModifiableEntity)) { GenerateType(typeof(T).BaseType !); } var dic = (from pi in typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly) where !(pi.HasAttribute <HiddenPropertyAttribute>() || (pi.CanWrite == false && pi.HasAttribute <ExpressionFieldAttribute>())) select KeyValuePair.Create(pi.Name, (IPropertyValidator) new PropertyValidator <T>(pi))).ToDictionary(); validators.SetDefinition(typeof(T), dic); }
public static void RegisterEntityLinks <T>(Func <Lite <T>, QuickLinkContext, QuickLink[]> getQuickLinks) where T : Entity { var current = EntityLinks.GetDefinition(typeof(T)); current += (t, p0) => { try { return(getQuickLinks((Lite <T>)t, p0)); } catch (global::System.Exception ex) { ex.LogException(); return(null); } }; EntityLinks.SetDefinition(typeof(T), current); }