Example #1
0
        /// <summary>
        /// Loads child objects from the given DAL provider.
        /// </summary>
        /// <param name="dal">The DAL provider to use.</param>
        private void FetchChildren(IA02_ContinentDal dal)
        {
            LoadProperty(A03_Continent_SingleObjectProperty, A03_Continent_Child.GetA03_Continent_Child(dal.A03_Continent_Child));
            LoadProperty(A03_Continent_ASingleObjectProperty, A03_Continent_ReChild.GetA03_Continent_ReChild(dal.A03_Continent_ReChild));
            LoadProperty(A03_SubContinentObjectsProperty, A03_SubContinentColl.GetA03_SubContinentColl(dal.A03_SubContinentColl));
            foreach (var item in dal.A05_SubContinent_Child)
            {
                var child = A05_SubContinent_Child.GetA05_SubContinent_Child(item);
                var obj   = A03_SubContinentObjects.FindA04_SubContinentByParentProperties(child.subContinent_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.A05_SubContinent_ReChild)
            {
                var child = A05_SubContinent_ReChild.GetA05_SubContinent_ReChild(item);
                var obj   = A03_SubContinentObjects.FindA04_SubContinentByParentProperties(child.subContinent_ID2);
                obj.LoadChild(child);
            }
            var a05_CountryColl = A05_CountryColl.GetA05_CountryColl(dal.A05_CountryColl);

            a05_CountryColl.LoadItems(A03_SubContinentObjects);
            foreach (var item in dal.A07_Country_Child)
            {
                var child = A07_Country_Child.GetA07_Country_Child(item);
                var obj   = a05_CountryColl.FindA06_CountryByParentProperties(child.country_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.A07_Country_ReChild)
            {
                var child = A07_Country_ReChild.GetA07_Country_ReChild(item);
                var obj   = a05_CountryColl.FindA06_CountryByParentProperties(child.country_ID2);
                obj.LoadChild(child);
            }
            var a07_RegionColl = A07_RegionColl.GetA07_RegionColl(dal.A07_RegionColl);

            a07_RegionColl.LoadItems(a05_CountryColl);
            foreach (var item in dal.A09_Region_Child)
            {
                var child = A09_Region_Child.GetA09_Region_Child(item);
                var obj   = a07_RegionColl.FindA08_RegionByParentProperties(child.region_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.A09_Region_ReChild)
            {
                var child = A09_Region_ReChild.GetA09_Region_ReChild(item);
                var obj   = a07_RegionColl.FindA08_RegionByParentProperties(child.region_ID2);
                obj.LoadChild(child);
            }
            var a09_CityColl = A09_CityColl.GetA09_CityColl(dal.A09_CityColl);

            a09_CityColl.LoadItems(a07_RegionColl);
            foreach (var item in dal.A11_City_Child)
            {
                var child = A11_City_Child.GetA11_City_Child(item);
                var obj   = a09_CityColl.FindA10_CityByParentProperties(child.city_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.A11_City_ReChild)
            {
                var child = A11_City_ReChild.GetA11_City_ReChild(item);
                var obj   = a09_CityColl.FindA10_CityByParentProperties(child.city_ID2);
                obj.LoadChild(child);
            }
            var a11_CityRoadColl = A11_CityRoadColl.GetA11_CityRoadColl(dal.A11_CityRoadColl);

            a11_CityRoadColl.LoadItems(a09_CityColl);
        }
        /// <summary>
        /// Loads child objects from the given SafeDataReader.
        /// </summary>
        /// <param name="dr">The SafeDataReader to use.</param>
        private void FetchChildren(SafeDataReader dr)
        {
            dr.NextResult();
            if (dr.Read())
            {
                LoadProperty(A03_Continent_SingleObjectProperty, A03_Continent_Child.GetA03_Continent_Child(dr));
            }
            dr.NextResult();
            if (dr.Read())
            {
                LoadProperty(A03_Continent_ASingleObjectProperty, A03_Continent_ReChild.GetA03_Continent_ReChild(dr));
            }
            dr.NextResult();
            LoadProperty(A03_SubContinentObjectsProperty, A03_SubContinentColl.GetA03_SubContinentColl(dr));
            dr.NextResult();
            while (dr.Read())
            {
                var child = A05_SubContinent_Child.GetA05_SubContinent_Child(dr);
                var obj   = A03_SubContinentObjects.FindA04_SubContinentByParentProperties(child.subContinent_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = A05_SubContinent_ReChild.GetA05_SubContinent_ReChild(dr);
                var obj   = A03_SubContinentObjects.FindA04_SubContinentByParentProperties(child.subContinent_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var a05_CountryColl = A05_CountryColl.GetA05_CountryColl(dr);

            a05_CountryColl.LoadItems(A03_SubContinentObjects);
            dr.NextResult();
            while (dr.Read())
            {
                var child = A07_Country_Child.GetA07_Country_Child(dr);
                var obj   = a05_CountryColl.FindA06_CountryByParentProperties(child.country_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = A07_Country_ReChild.GetA07_Country_ReChild(dr);
                var obj   = a05_CountryColl.FindA06_CountryByParentProperties(child.country_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var a07_RegionColl = A07_RegionColl.GetA07_RegionColl(dr);

            a07_RegionColl.LoadItems(a05_CountryColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = A09_Region_Child.GetA09_Region_Child(dr);
                var obj   = a07_RegionColl.FindA08_RegionByParentProperties(child.region_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = A09_Region_ReChild.GetA09_Region_ReChild(dr);
                var obj   = a07_RegionColl.FindA08_RegionByParentProperties(child.region_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var a09_CityColl = A09_CityColl.GetA09_CityColl(dr);

            a09_CityColl.LoadItems(a07_RegionColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = A11_City_Child.GetA11_City_Child(dr);
                var obj   = a09_CityColl.FindA10_CityByParentProperties(child.city_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = A11_City_ReChild.GetA11_City_ReChild(dr);
                var obj   = a09_CityColl.FindA10_CityByParentProperties(child.city_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var a11_CityRoadColl = A11_CityRoadColl.GetA11_CityRoadColl(dr);

            a11_CityRoadColl.LoadItems(a09_CityColl);
        }