internal static void SetRelation(this RelationListeType rel, string name, IPersonRelationType[] relations) { var prop = rel.GetType().GetProperty(name); if (relations != null) { var rels = Array.CreateInstance(prop.PropertyType.GetElementType(), relations.Length); for (int i = 0; i < relations.Length; i++) { rels.SetValue(relations[i], i); } prop.SetValue(rel, rels, null); } }
internal static IPersonRelationType[] GetRelation(this RelationListeType rel, string name) { return(rel.GetType().InvokeMember(name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Instance, null, rel, null) as IPersonRelationType[]); }
internal static IPersonRelationType CreateRelation(this RelationListeType rel, string name) { var memberType = rel.GetType().GetProperty(name).PropertyType.GetElementType(); return(memberType.InvokeMember(null, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.CreateInstance | System.Reflection.BindingFlags.Instance, null, rel, null) as IPersonRelationType); }