/// <summary> /// Loads <see cref="B06_Country"/> items on the B05_CountryObjects collection. /// </summary> /// <param name="collection">The grand parent <see cref="B03_SubContinentColl"/> collection.</param> internal void LoadItems(B03_SubContinentColl collection) { foreach (var item in this) { var obj = collection.FindB04_SubContinentByParentProperties(item.parent_SubContinent_ID); var rlce = obj.B05_CountryObjects.RaiseListChangedEvents; obj.B05_CountryObjects.RaiseListChangedEvents = false; obj.B05_CountryObjects.Add(item); obj.B05_CountryObjects.RaiseListChangedEvents = rlce; } }
/// <summary> /// Factory method. Loads a <see cref="B02_Continent"/> object from the given SafeDataReader. /// </summary> /// <param name="dr">The SafeDataReader to use.</param> /// <returns>A reference to the fetched <see cref="B02_Continent"/> object.</returns> internal static B02_Continent GetB02_Continent(SafeDataReader dr) { B02_Continent obj = new B02_Continent(); // show the framework that this is a child object obj.MarkAsChild(); obj.Fetch(dr); obj.LoadProperty(B03_SubContinentObjectsProperty, B03_SubContinentColl.NewB03_SubContinentColl()); obj.MarkOld(); return(obj); }
/// <summary> /// Loads child objects from the given SafeDataReader. /// </summary> /// <param name="dr">The SafeDataReader to use.</param> internal void FetchChildren(SafeDataReader dr) { dr.NextResult(); while (dr.Read()) { var child = B03_Continent_Child.GetB03_Continent_Child(dr); var obj = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID1); obj.LoadProperty(B03_Continent_SingleObjectProperty, child); } dr.NextResult(); while (dr.Read()) { var child = B03_Continent_ReChild.GetB03_Continent_ReChild(dr); var obj = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID2); obj.LoadProperty(B03_Continent_ASingleObjectProperty, child); } dr.NextResult(); var b03_SubContinentColl = B03_SubContinentColl.GetB03_SubContinentColl(dr); b03_SubContinentColl.LoadItems((B01_ContinentColl)Parent); dr.NextResult(); while (dr.Read()) { var child = B05_SubContinent_Child.GetB05_SubContinent_Child(dr); var obj = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = B05_SubContinent_ReChild.GetB05_SubContinent_ReChild(dr); var obj = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID2); obj.LoadChild(child); } dr.NextResult(); var b05_CountryColl = B05_CountryColl.GetB05_CountryColl(dr); b05_CountryColl.LoadItems(b03_SubContinentColl); dr.NextResult(); while (dr.Read()) { var child = B07_Country_Child.GetB07_Country_Child(dr); var obj = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = B07_Country_ReChild.GetB07_Country_ReChild(dr); var obj = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID2); obj.LoadChild(child); } dr.NextResult(); var b07_RegionColl = B07_RegionColl.GetB07_RegionColl(dr); b07_RegionColl.LoadItems(b05_CountryColl); dr.NextResult(); while (dr.Read()) { var child = B09_Region_Child.GetB09_Region_Child(dr); var obj = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = B09_Region_ReChild.GetB09_Region_ReChild(dr); var obj = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID2); obj.LoadChild(child); } dr.NextResult(); var b09_CityColl = B09_CityColl.GetB09_CityColl(dr); b09_CityColl.LoadItems(b07_RegionColl); dr.NextResult(); while (dr.Read()) { var child = B11_City_Child.GetB11_City_Child(dr); var obj = b09_CityColl.FindB10_CityByParentProperties(child.city_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = B11_City_ReChild.GetB11_City_ReChild(dr); var obj = b09_CityColl.FindB10_CityByParentProperties(child.city_ID2); obj.LoadChild(child); } dr.NextResult(); var b11_CityRoadColl = B11_CityRoadColl.GetB11_CityRoadColl(dr); b11_CityRoadColl.LoadItems(b09_CityColl); }
/// <summary> /// Loads child objects from the given DAL provider. /// </summary> /// <param name="dal">The DAL provider to use.</param> internal void FetchChildren(IB01_ContinentCollDal dal) { foreach (var item in dal.B03_Continent_Child) { var child = B03_Continent_Child.GetB03_Continent_Child(item); var obj = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID1); obj.LoadProperty(B03_Continent_SingleObjectProperty, child); } foreach (var item in dal.B03_Continent_ReChild) { var child = B03_Continent_ReChild.GetB03_Continent_ReChild(item); var obj = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID2); obj.LoadProperty(B03_Continent_ASingleObjectProperty, child); } var b03_SubContinentColl = B03_SubContinentColl.GetB03_SubContinentColl(dal.B03_SubContinentColl); b03_SubContinentColl.LoadItems((B01_ContinentColl)Parent); foreach (var item in dal.B05_SubContinent_Child) { var child = B05_SubContinent_Child.GetB05_SubContinent_Child(item); var obj = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID1); obj.LoadChild(child); } foreach (var item in dal.B05_SubContinent_ReChild) { var child = B05_SubContinent_ReChild.GetB05_SubContinent_ReChild(item); var obj = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID2); obj.LoadChild(child); } var b05_CountryColl = B05_CountryColl.GetB05_CountryColl(dal.B05_CountryColl); b05_CountryColl.LoadItems(b03_SubContinentColl); foreach (var item in dal.B07_Country_Child) { var child = B07_Country_Child.GetB07_Country_Child(item); var obj = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID1); obj.LoadChild(child); } foreach (var item in dal.B07_Country_ReChild) { var child = B07_Country_ReChild.GetB07_Country_ReChild(item); var obj = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID2); obj.LoadChild(child); } var b07_RegionColl = B07_RegionColl.GetB07_RegionColl(dal.B07_RegionColl); b07_RegionColl.LoadItems(b05_CountryColl); foreach (var item in dal.B09_Region_Child) { var child = B09_Region_Child.GetB09_Region_Child(item); var obj = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID1); obj.LoadChild(child); } foreach (var item in dal.B09_Region_ReChild) { var child = B09_Region_ReChild.GetB09_Region_ReChild(item); var obj = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID2); obj.LoadChild(child); } var b09_CityColl = B09_CityColl.GetB09_CityColl(dal.B09_CityColl); b09_CityColl.LoadItems(b07_RegionColl); foreach (var item in dal.B11_City_Child) { var child = B11_City_Child.GetB11_City_Child(item); var obj = b09_CityColl.FindB10_CityByParentProperties(child.city_ID1); obj.LoadChild(child); } foreach (var item in dal.B11_City_ReChild) { var child = B11_City_ReChild.GetB11_City_ReChild(item); var obj = b09_CityColl.FindB10_CityByParentProperties(child.city_ID2); obj.LoadChild(child); } var b11_CityRoadColl = B11_CityRoadColl.GetB11_CityRoadColl(dal.B11_CityRoadColl); b11_CityRoadColl.LoadItems(b09_CityColl); }