/// <summary> /// Create a new list for storing the specified type of objects. /// </summary> public GentleRelation( PersistenceBroker broker, Type containedType, IPersistent parent, params Type[] relatedTypes ) : base( broker ) { Check.VerifyNotNull( relatedTypes, Error.NullParameter, "relatedTypes" ); /*Check.Verify( parent == null && relatedTypes.Length == 2 || parent != null && relatedTypes.Length == 1, Error.NotImplemented, "The GentleRelation class is currently only able to manage two-way relations." ); */ this.relatedTypes = relatedTypes; this.parent = parent; containedMap = ObjectFactory.GetMap( broker, containedType ); // note: "this." required on broker param or original null param might get passed relations = new GentleList( this.broker, containedType, parent ); // verify that the linked types are supported by Gentle foreach( Type relatedType in relatedTypes ) { Check.Verify( relatedType.IsSubclassOf( typeof(Persistent) ) || relatedType.GetInterface( "IPersistent" ) != null, Error.UnsupportedType, relatedType ); } }
/// <summary> /// Create a new list for storing the specified type of objects. /// </summary> public GentleRelation(PersistenceBroker broker, Type containedType, IPersistent parent, params Type[] relatedTypes) : base(broker) { Check.VerifyNotNull(relatedTypes, Error.NullParameter, "relatedTypes"); /*Check.Verify( parent == null && relatedTypes.Length == 2 || * parent != null && relatedTypes.Length == 1, Error.NotImplemented, * "The GentleRelation class is currently only able to manage two-way relations." ); */ this.relatedTypes = relatedTypes; this.parent = parent; containedMap = ObjectFactory.GetMap(broker, containedType); // note: "this." required on broker param or original null param might get passed relations = new GentleList(this.broker, containedType, parent); // verify that the linked types are supported by Gentle foreach (Type relatedType in relatedTypes) { Check.Verify(relatedType.IsSubclassOf(typeof(Persistent)) || relatedType.GetInterface("IPersistent") != null, Error.UnsupportedType, relatedType); } }