public void Test_CreatedBusinessObject_SaveBO() { //Saving a created business object should remove the business // object from the created col. it should still exist in // the main collection and should be added to the persisted collection //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); IMultipleRelationship cpRelationship = (IMultipleRelationship)organisationTestBO.Relationships["ContactPeople"]; RelatedBusinessObjectCollection <ContactPersonTestBO> cpCol = new RelatedBusinessObjectCollection <ContactPersonTestBO>(cpRelationship); cpCol.LoadAll(); ContactPersonTestBO newCP = cpCol.CreateBusinessObject(); newCP.Surname = TestUtil.GetRandomString(); newCP.FirstName = TestUtil.GetRandomString(); RegisterForAddedEvent(cpCol); //---------------Assert Preconditions -------------- Assert.IsFalse(_addedEventFired); AssertOneObjectInCurrentAndCreatedCollection(cpCol); //---------------Execute Test ---------------------- newCP.Save(); //---------------Test Result ----------------------- Assert.IsFalse(_addedEventFired); Assert.Contains(newCP, cpCol); AssertOneObjectInCurrentAndPersistedCollection(cpCol); }
/// <summary> /// Returns a collection of business objects that are connected to /// this object through the specified relationship (eg. would return /// a father and a mother if the relationship was "parents"). This /// method is to be used in the case of multiple relationships. /// </summary> /// <param name="relationshipName">The name of the relationship</param> /// <returns>Returns a business object collection</returns> /// <exception cref="InvalidRelationshipAccessException">Thrown if /// the relationship specified is a single relationship, when a /// multiple one was expected</exception> public virtual IBusinessObjectCollection GetRelatedCollection(string relationshipName) { ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName"); IMultipleRelationship multipleRelationship = GetMultiple(relationshipName); return(multipleRelationship.BusinessObjectCollection); }
///<summary> /// Returns a multiple relationship for with the specified relationship name. ///</summary> ///<param name="relationshipName">The specified relationship name</param> ///<returns>The multiple relationship</returns> public IMultipleRelationship GetMultiple(string relationshipName) { ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName"); IMultipleRelationship relationship = GetRelationshipAsMultiple(relationshipName); return(relationship); }
public void Test_CreateBusinessObject() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); IMultipleRelationship cpRelationship = (IMultipleRelationship)organisationTestBO.Relationships["ContactPeople"]; RelatedBusinessObjectCollection <ContactPersonTestBO> cpCol = new RelatedBusinessObjectCollection <ContactPersonTestBO>(cpRelationship); cpCol.LoadAll(); RegisterForAddedEvent(cpCol); //---------------Assert Precondition---------------- Assert.AreEqual(0, cpCol.Count); Assert.IsFalse(_addedEventFired); Assert.AreEqual(0, cpCol.PersistedBusinessObjects.Count); //---------------Execute Test ---------------------- ContactPersonTestBO newCP = cpCol.CreateBusinessObject(); //---------------Test Result ----------------------- AssertOneObjectInCurrentAndCreatedCollection(cpCol); Assert.Contains(newCP, cpCol.CreatedBusinessObjects); Assert.Contains(newCP, cpCol); Assert.IsFalse(cpCol.PersistedBusinessObjects.Contains(newCP)); Assert.IsTrue(_addedEventFired); }
public void TestColIsInstantiatedButNotLoaded() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); OrganisationTestBO.LoadDefaultClassDef(); IClassDef contactPersonClassDef = ContactPersonTestBO.LoadClassDefOrganisationTestBORelationship_MultipleReverse(); RelKeyDef keyDef = new RelKeyDef(); keyDef.Add(new RelPropDef(contactPersonClassDef.PropDefcol["OrganisationID"], "OrganisationID")); MultipleRelationshipDef def = new MultipleRelationshipDef (TestUtil.GetRandomString(), typeof(ContactPersonTestBO), keyDef, false, "", DeleteParentAction.DoNothing); OrganisationTestBO organisation = new OrganisationTestBO(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- IMultipleRelationship rel = (IMultipleRelationship)def.CreateRelationship(organisation, organisation.Props); //---------------Test Result ----------------------- IBusinessObjectCollection collection = rel.BusinessObjectCollection; Assert.IsNotNull(collection); Assert.AreEqual(0, collection.Count); Assert.AreSame(contactPersonClassDef, collection.ClassDef); Assert.IsNotNull(collection.SelectQuery.Criteria); Assert.IsNotNull(collection.SelectQuery.Criteria.Field); Assert.AreEqual("OrganisationID", collection.SelectQuery.Criteria.Field.PropertyName); Assert.IsNotNull(collection.SelectQuery.Criteria.Field.Source); Assert.AreEqual("ContactPersonTestBO", collection.SelectQuery.Criteria.Field.Source.Name); Assert.AreEqual(organisation.OrganisationID.Value, collection.SelectQuery.Criteria.FieldValue); Assert.IsInstanceOf(typeof(ContactPersonTestBO), collection.CreateBusinessObject()); }
///<summary> /// Returns a strongly typed multiple relationship for with the specified relationship name. ///</summary> ///<param name="relationshipName">The specified relationship name</param> ///<returns>The multiple relationship</returns> public MultipleRelationship <T> GetMultiple <T>(string relationshipName) where T : BusinessObject, new() { ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName"); IMultipleRelationship relationship = GetRelationshipAsMultiple(relationshipName); return((MultipleRelationship <T>)relationship); }
private static RelatedBusinessObjectCollection <ContactPersonTestBO> CreateRelatedCPCol() { OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); IMultipleRelationship cpRelationship = (IMultipleRelationship)organisationTestBO.Relationships["ContactPeople"]; return(new RelatedBusinessObjectCollection <ContactPersonTestBO>(cpRelationship)); }
public static string[] ToRelationPNRsOrNull(this IMultipleRelationship rel) { if (rel != null && rel.RelationPNRs != null) { return(rel.RelationPNRs.Select(pnr => Converters.ToPnrStringOrNull(pnr)).ToArray()); } return(null); }
/// <summary> /// Update the Underlying relationship collection e.g. The added or removed Business Object Collections are updated. /// </summary> protected override void UpdateCollections() { // RelationshipBase relationshipBase = (RelationshipBase)Relationship; IMultipleRelationship relationship = Relationship as IMultipleRelationship; if (relationship != null) { relationship.BusinessObjectCollection.AddedBusinessObjects.Remove(this.RelatedBO); } }
public void TestCreateRelationship() { IMultipleRelationship rel = (IMultipleRelationship)_multipleRelationshipDef.CreateRelationship(_fakeBO, _fakeBO.PropCol); Assert.AreEqual(_multipleRelationshipDef.RelationshipName, rel.RelationshipName); Assert.IsTrue(_fakeBO.GetPropertyValue("MockBOProp1") == null); Assert.AreEqual(0, rel.BusinessObjectCollection.Count); }
/// <summary> /// Update the Underlying relationship collection e.g. The added or removed Business Object Collections are updated. /// </summary> protected override void UpdateCollections() { // SingleRelationshipBase relationshipBase = (SingleRelationshipBase)Relationship; IMultipleRelationship relationship = Relationship as IMultipleRelationship; if (relationship != null) { IBusinessObjectCollection businessObjectCollection = relationship.BusinessObjectCollection; businessObjectCollection.RemovedBusinessObjects.Remove(this.RelatedBO); businessObjectCollection.PersistedBusinessObjects.Remove(this.RelatedBO); } }
private static RelatedBusinessObjectCollection <ContactPersonTestBO> CreateCollectionWith_OneBO() { OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); IMultipleRelationship cpRelationship = (IMultipleRelationship)organisationTestBO.Relationships["ContactPeople"]; RelatedBusinessObjectCollection <ContactPersonTestBO> cpCol = new RelatedBusinessObjectCollection <ContactPersonTestBO>(cpRelationship); ContactPersonTestBO cp = cpCol.CreateBusinessObject(); cp.FirstName = TestUtil.GetRandomString(); cp.Surname = TestUtil.GetRandomString(); cp.Save(); return(BORegistry.DataAccessor.BusinessObjectLoader.GetRelatedBusinessObjectCollection <ContactPersonTestBO> (cpRelationship)); }
public void Test_LoadBoCol() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); CreateSavedContactPerson(organisationTestBO); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- IMultipleRelationship cpRelationship = (IMultipleRelationship)organisationTestBO.Relationships["ContactPeople"]; IBusinessObjectCollection cpCol = BORegistry.DataAccessor.BusinessObjectLoader.GetRelatedBusinessObjectCollection(typeof(ContactPersonTestBO), cpRelationship); //---------------Test Result ----------------------- AssertOneObjectInCurrentAndPersistedCollection(cpCol); }
/// <summary> /// Sets the Value of the <see cref="IMultipleRelationship"/> to a list of values as configured using the WithMany. /// </summary> /// <param name="multipleRelationship"></param> private void SetRelationshipToValidValue(IMultipleRelationship multipleRelationship) { if (!_defaultValueRegistry.IsRegistered(multipleRelationship.RelationshipName)) { return; } IList lists = (IList)_defaultValueRegistry.Resolve(multipleRelationship.RelationshipName); if (lists == null) { return; } foreach (var item in lists) { multipleRelationship.BusinessObjectCollection.Add(item); } }
public void Test_SetSingleReverseRelationship_WhenMultipleReverseRelationshipNotLoaded_ShouldUpdateRelatedBOCol() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation(); IMultipleRelationship relationship = (IMultipleRelationship)organisationTestBO.Relationships["ContactPeople"]; ContactPersonTestBO contactPerson = organisation.ContactPeople.CreateBusinessObject(); //---------------Assert Precondition---------------- //Assert.IsNull(contactPerson.Organisation); //---------------Execute Test ---------------------- contactPerson.Organisation = organisationTestBO; //---------------Test Result ----------------------- Assert.AreEqual(1, relationship.BusinessObjectCollection.Count); Assert.AreEqual(1, relationship.BusinessObjectCollection.CreatedBusinessObjects.Count); }
public void TestGetMultiple() { //---------------Set up test pack------------------- IClassDef classDef = MyBO.LoadClassDefWithRelationship(); MyRelatedBo.LoadClassDef(); MyBO bo1 = (MyBO)classDef.CreateNewBusinessObject(); string relationshipName = "MyMultipleRelationship"; //---------------Execute Test ---------------------- IMultipleRelationship relationship = bo1.Relationships.GetMultiple(relationshipName); //---------------Test Result ----------------------- Assert.IsNotNull(relationship); Assert.AreEqual(relationshipName, relationship.RelationshipName); }
public void Test_CreateBusinessObject_OnlyFiresOneAddedEvent() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); MyBO.LoadClassDefWithRelationship(); MyRelatedBo.LoadClassDef(); MyBO bo = new MyBO(); IMultipleRelationship rel = bo.Relationships.GetMultiple("MyMultipleRelationship"); RelatedBusinessObjectCollection <MyRelatedBo> col = (RelatedBusinessObjectCollection <MyRelatedBo>)rel.BusinessObjectCollection; int addedEventCount = 0; col.BusinessObjectAdded += (sender, e) => addedEventCount++; //---------------Assert Precondition---------------- Assert.AreEqual(0, addedEventCount); //---------------Execute Test ---------------------- col.CreateBusinessObject(); //---------------Test Result ----------------------- Assert.AreEqual(1, addedEventCount); }
public void TestGetMultiple_Fail() { //---------------Set up test pack------------------- IClassDef classDef = MyBO.LoadClassDefWithRelationship(); MyRelatedBo.LoadClassDef(); MyBO bo1 = (MyBO)classDef.CreateNewBusinessObject(); string relationshipName = "MyRelationship"; //---------------Execute Test ---------------------- try { IMultipleRelationship relationship = bo1.Relationships.GetMultiple(relationshipName); Assert.Fail("Should have failed because we're accessing a single relationship as a multiple."); //---------------Test Result ----------------------- } catch (InvalidRelationshipAccessException) { } }
public void Test_CreateBusinessObject_AddedToTheCollection() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); MyBO.LoadClassDefWithRelationship(); MyRelatedBo.LoadClassDef(); MyBO bo = new MyBO(); IMultipleRelationship rel = bo.Relationships.GetMultiple("MyMultipleRelationship"); RelatedBusinessObjectCollection <MyRelatedBo> col = new RelatedBusinessObjectCollection <MyRelatedBo>(rel); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- MyRelatedBo relatedBo = col.CreateBusinessObject(); //---------------Test Result ----------------------- Assert.AreEqual(bo.MyBoID, relatedBo.MyBoID, "The foreign key should eb set"); Assert.IsTrue(relatedBo.Status.IsNew); Assert.AreEqual(1, col.CreatedBusinessObjects.Count, "The created BOs should be added"); Assert.AreEqual(0, col.AddedBusinessObjects.Count); Assert.AreEqual(1, col.Count); }
private void LoadRelationshipNode(IRelationship relationship, ITreeNodeCollection nodes) { if (relationship is IMultipleRelationship) { IMultipleRelationship multipleRelationship = (IMultipleRelationship)relationship; IBusinessObjectCollection children = multipleRelationship.BusinessObjectCollection; foreach (IBusinessObject businessObject in children.Clone()) { AddBusinessObjectNode(nodes, businessObject); } } else { ISingleRelationship singleRelationship = (ISingleRelationship)relationship; IBusinessObject businessObject = singleRelationship.GetRelatedObject(); if (businessObject != null) { AddBusinessObjectNode(nodes, businessObject); } } }
internal static void SetupCriteriaForRelationship(IMultipleRelationship relationship, IBusinessObjectCollection collection) { Criteria relationshipCriteria = Criteria.FromRelationship(relationship); IOrderCriteria preparedOrderCriteria; var orderCriteriaString = relationship.OrderCriteria.ToString(); try { preparedOrderCriteria = QueryBuilder.CreateOrderCriteria(relationship.RelatedObjectClassDef, orderCriteriaString); } catch (InvalidOrderCriteriaException) { throw new InvalidOrderCriteriaException("The Relationship '" + relationship.RelationshipName + "' on the ClassDef '" + relationship.OwningBO.ClassDef.ClassNameFull + "' has an Invalid OrderCriteria '" + orderCriteriaString); } //QueryBuilder.PrepareCriteria(relationship.RelatedObjectClassDef, relationshipCriteria); collection.SelectQuery.Criteria = relationshipCriteria; collection.SelectQuery.OrderCriteria = preparedOrderCriteria; }
public void Test_LoadRelatedBoCol() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); IMultipleRelationship cpRelationship = (IMultipleRelationship)organisationTestBO.Relationships["ContactPeople"]; ContactPersonTestBO cp = (ContactPersonTestBO)cpRelationship.BusinessObjectCollection.CreateBusinessObject(); cp.FirstName = TestUtil.GetRandomString(); cp.Surname = TestUtil.GetRandomString(); cp.Save(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- IBusinessObjectCollection cpCol = BORegistry.DataAccessor.BusinessObjectLoader.GetRelatedBusinessObjectCollection (typeof(ContactPersonTestBO), cpRelationship); //---------------Test Result ----------------------- AssertOneObjectInCurrentAndPersistedCollection(cpCol); }
private void SetupRelationshipNodeDummy(IRelationship relationship, NodeState nodeState) { int childCount = 0; if (relationship is IMultipleRelationship) { IMultipleRelationship multipleRelationship = (IMultipleRelationship)relationship; IBusinessObjectCollection businessObjectCollection = multipleRelationship.BusinessObjectCollection; ChildCollectionNodes.Add(businessObjectCollection, nodeState); RegisterForBusinessObjectCollectionEvents(businessObjectCollection); childCount = businessObjectCollection.Count; } else { //TODO: Do something decent with Single Relationship Updated Event ISingleRelationship singleRelationship = (ISingleRelationship)relationship; if (singleRelationship.HasRelatedObject()) { childCount = 1; } } UpdateNodeDummy(nodeState, childCount); }
private void RemoveRelationshipNode(IRelationship relationship) { this.RelationshipNodes.Remove(relationship); if (relationship is IMultipleRelationship) { IMultipleRelationship multipleRelationship = (IMultipleRelationship)relationship; IBusinessObjectCollection children = multipleRelationship.BusinessObjectCollection; ChildCollectionNodes.Remove(children); foreach (IBusinessObject businessObject in children.Clone()) { RemoveBusinessObjectNode(businessObject); } } else { ISingleRelationship singleRelationship = (ISingleRelationship)relationship; IBusinessObject businessObject = singleRelationship.GetRelatedObject(); if (businessObject != null) { RemoveBusinessObjectNode(businessObject); } } }
private void AddChildIfNeeded(string childName, RelationshipCol relationshipCol) { IRelationshipDefCol relationshipDefCol = ClassDef.RelationshipDefCol; if (relationshipDefCol.Contains(childName)) { IRelationshipDef relationshipDef = relationshipDefCol[childName]; #pragma warning disable 168 IClassDef classDef = relationshipDef.RelatedObjectClassDef; #pragma warning restore 168 IMultipleRelationship relationship = (IMultipleRelationship)relationshipDef.CreateRelationship(this, this._boPropCol); //_mock.DynamicMock<IMultipleRelationship>(); //(this, relationshipDef, this._boPropCol); //BusinessObjectCollection<BusinessObject> businessObjectCollection = new BusinessObjectCollection<BusinessObject>(classDef); //SetupResult.For(relationship.BusinessObjectCollection) // .Return(businessObjectCollection); //SetupResult.For(relationship.RelationshipName) // .Return(businessObjectCollection); //SetupResult.For(relationship.GetRelatedBusinessObjectCol<BusinessObject>()) // .Return(businessObjectCollection); relationshipCol.Add(relationship); } }
/// <summary> /// Creates a <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> with boType as its type parameter, using the Activator. /// </summary> /// <param name="boType">The type parameter to be used</param> /// <param name="relationship">The relationship that this <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> is the collection for</param> /// <returns>The instantiated <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/></returns> public static IBusinessObjectCollection CreateRelatedBusinessObjectCollection(Type boType, IMultipleRelationship relationship) { IBusinessObjectCollection collection = CreateNewRelatedBusinessObjectCollection(boType, relationship); SetupCriteriaForRelationship(relationship, collection); return collection; }
/// <summary> /// Loads a RelatedBusinessObjectCollection using the Relationship given. This method is used by relationships to load based on the /// fields defined in the relationship. /// </summary> /// <typeparam name="T">The type of collection to load. This must be a class that implements IBusinessObject and has a parameterless constructor</typeparam> /// <param name="relationship">The relationship that defines the criteria that must be loaded. For example, a Person might have /// a Relationship called Addresses, which defines the PersonID property as the relationship property. In this case, calling this method /// with the Addresses relationship will load a collection of Address where PersonID = '?', where the ? is the value of the owning Person's /// PersonID</param> /// <returns>The loaded RelatedBusinessObjectCollection</returns> public static RelatedBusinessObjectCollection <T> GetRelatedBusinessObjectCollection <T>(IMultipleRelationship relationship) where T : class, IBusinessObject, new() { return(BORegistry.DataAccessor.BusinessObjectLoader.GetRelatedBusinessObjectCollection <T>(relationship)); }
/// <summary> /// Creates a <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> with boType as its type parameter, using the Activator. /// </summary> /// <param name="boClassName"></param> /// <param name="relationship">The relationship that this <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> is the collection for</param> /// <param name="boAssemblyName"></param> /// <returns>The instantiated <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/></returns> public static IBusinessObjectCollection CreateRelatedBusinessObjectCollection(string boAssemblyName, string boClassName, IMultipleRelationship relationship) { var collection = CreateNewRelatedBusinessObjectCollection(boAssemblyName, boClassName, relationship); SetupCriteriaForRelationship(relationship, collection); return collection; }
/// <summary> /// Creates a <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> with boType as its type parameter, using the Activator. /// </summary> /// <param name="boClassName"></param> /// <param name="relationship">The relationship that this <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> is the collection for</param> /// <param name="boAssemblyName"></param> /// <returns>The instantiated <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/></returns> public static IBusinessObjectCollection CreateRelatedBusinessObjectCollection(string boAssemblyName, string boClassName, IMultipleRelationship relationship) { var collection = CreateNewRelatedBusinessObjectCollection(boAssemblyName, boClassName, relationship); SetupCriteriaForRelationship(relationship, collection); return(collection); }
/// <summary> /// Creates a <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> with boType as its type parameter, using the Activator. /// </summary> /// <param name="boType">The type parameter to be used</param> /// <param name="relationship">The relationship that this <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/> is the collection for</param> /// <returns>The instantiated <see cref="RelatedBusinessObjectCollection{TBusinessObject}"/></returns> public static IBusinessObjectCollection CreateRelatedBusinessObjectCollection(Type boType, IMultipleRelationship relationship) { IBusinessObjectCollection collection = CreateNewRelatedBusinessObjectCollection(boType, relationship); SetupCriteriaForRelationship(relationship, collection); return(collection); }
/// <summary> /// Sets the Value of the <see cref="IMultipleRelationship"/> to a list of values as configured using the WithMany. /// </summary> /// <param name="multipleRelationship"></param> private void SetRelationshipToValidValue(IMultipleRelationship multipleRelationship) { if (!_defaultValueRegistry.IsRegistered(multipleRelationship.RelationshipName)) return; IList lists = (IList) _defaultValueRegistry.Resolve(multipleRelationship.RelationshipName); if (lists == null) return; foreach (var item in lists) { multipleRelationship.BusinessObjectCollection.Add(item); } }
internal static void SetupCriteriaForRelationship(IMultipleRelationship relationship, IBusinessObjectCollection collection) { Criteria relationshipCriteria = Criteria.FromRelationship(relationship); IOrderCriteria preparedOrderCriteria; var orderCriteriaString = relationship.OrderCriteria.ToString(); try { preparedOrderCriteria = QueryBuilder.CreateOrderCriteria(relationship.RelatedObjectClassDef, orderCriteriaString); } catch (InvalidOrderCriteriaException) { throw new InvalidOrderCriteriaException("The Relationship '" + relationship.RelationshipName + "' on the ClassDef '" + relationship.OwningBO.ClassDef.ClassNameFull + "' has an Invalid OrderCriteria '" + orderCriteriaString); } //QueryBuilder.PrepareCriteria(relationship.RelatedObjectClassDef, relationshipCriteria); collection.SelectQuery.Criteria = relationshipCriteria; collection.SelectQuery.OrderCriteria = preparedOrderCriteria; }
/// <summary> /// Loads a RelatedBusinessObjectCollection using the Relationship given. This method is used by relationships to load based on the /// fields defined in the relationship. /// </summary> /// <param name="type">The type of collection to load. This must be a class that implements IBusinessObject</param> /// <param name="relationship">The relationship that defines the criteria that must be loaded. For example, a Person might have /// a Relationship called Addresses, which defines the PersonID property as the relationship property. In this case, calling this method /// with the Addresses relationship will load a collection of Address where PersonID = '?', where the ? is the value of the owning Person's /// PersonID</param> /// <returns>The loaded RelatedBusinessObjectCollection</returns> public static IBusinessObjectCollection GetRelatedBusinessObjectCollection(Type type, IMultipleRelationship relationship) { return(BORegistry.DataAccessor.BusinessObjectLoader.GetRelatedBusinessObjectCollection(type, relationship)); }
/// <summary> /// Loads a RelatedBusinessObjectCollection using the Relationship given. This method is used by relationships to load based on the /// fields defined in the relationship. /// </summary> /// <param name="type">The type of collection to load. This must be a class that implements IBusinessObject</param> /// <param name="relationship">The relationship that defines the criteria that must be loaded. For example, a Person might have /// a Relationship called Addresses, which defines the PersonID property as the relationship property. In this case, calling this method /// with the Addresses relationship will load a collection of Address where PersonID = '?', where the ? is the value of the owning Person's /// PersonID</param> /// <returns>The loaded RelatedBusinessObjectCollection</returns> public IBusinessObjectCollection GetRelatedBusinessObjectCollection(Type type, IMultipleRelationship relationship) { if (_businessObjectLoaders.ContainsKey(type)) { return(_businessObjectLoaders[type].GetRelatedBusinessObjectCollection(type, relationship)); } return(_defaultBusinessObjectLoader.GetRelatedBusinessObjectCollection(type, relationship)); }