Пример #1
0
        /// <summary>
        /// Loads child objects from the given DAL provider.
        /// </summary>
        /// <param name="dal">The DAL provider to use.</param>
        internal void FetchChildren(IF01_ContinentCollDal dal)
        {
            foreach (var item in dal.F03_Continent_Child)
            {
                var child = F03_Continent_Child.GetF03_Continent_Child(item);
                var obj   = ((F01_ContinentColl)Parent).FindF02_ContinentByParentProperties(child.continent_ID1);
                obj.LoadProperty(F03_Continent_SingleObjectProperty, child);
            }
            foreach (var item in dal.F03_Continent_ReChild)
            {
                var child = F03_Continent_ReChild.GetF03_Continent_ReChild(item);
                var obj   = ((F01_ContinentColl)Parent).FindF02_ContinentByParentProperties(child.continent_ID2);
                obj.LoadProperty(F03_Continent_ASingleObjectProperty, child);
            }
            var f03_SubContinentColl = F03_SubContinentColl.GetF03_SubContinentColl(dal.F03_SubContinentColl);

            f03_SubContinentColl.LoadItems((F01_ContinentColl)Parent);
            foreach (var item in dal.F05_SubContinent_Child)
            {
                var child = F05_SubContinent_Child.GetF05_SubContinent_Child(item);
                var obj   = f03_SubContinentColl.FindF04_SubContinentByParentProperties(child.subContinent_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.F05_SubContinent_ReChild)
            {
                var child = F05_SubContinent_ReChild.GetF05_SubContinent_ReChild(item);
                var obj   = f03_SubContinentColl.FindF04_SubContinentByParentProperties(child.subContinent_ID2);
                obj.LoadChild(child);
            }
            var f05_CountryColl = F05_CountryColl.GetF05_CountryColl(dal.F05_CountryColl);

            f05_CountryColl.LoadItems(f03_SubContinentColl);
            foreach (var item in dal.F07_Country_Child)
            {
                var child = F07_Country_Child.GetF07_Country_Child(item);
                var obj   = f05_CountryColl.FindF06_CountryByParentProperties(child.country_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.F07_Country_ReChild)
            {
                var child = F07_Country_ReChild.GetF07_Country_ReChild(item);
                var obj   = f05_CountryColl.FindF06_CountryByParentProperties(child.country_ID2);
                obj.LoadChild(child);
            }
            var f07_RegionColl = F07_RegionColl.GetF07_RegionColl(dal.F07_RegionColl);

            f07_RegionColl.LoadItems(f05_CountryColl);
            foreach (var item in dal.F09_Region_Child)
            {
                var child = F09_Region_Child.GetF09_Region_Child(item);
                var obj   = f07_RegionColl.FindF08_RegionByParentProperties(child.region_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.F09_Region_ReChild)
            {
                var child = F09_Region_ReChild.GetF09_Region_ReChild(item);
                var obj   = f07_RegionColl.FindF08_RegionByParentProperties(child.region_ID2);
                obj.LoadChild(child);
            }
            var f09_CityColl = F09_CityColl.GetF09_CityColl(dal.F09_CityColl);

            f09_CityColl.LoadItems(f07_RegionColl);
            foreach (var item in dal.F11_City_Child)
            {
                var child = F11_City_Child.GetF11_City_Child(item);
                var obj   = f09_CityColl.FindF10_CityByParentProperties(child.city_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.F11_City_ReChild)
            {
                var child = F11_City_ReChild.GetF11_City_ReChild(item);
                var obj   = f09_CityColl.FindF10_CityByParentProperties(child.city_ID2);
                obj.LoadChild(child);
            }
            var f11_CityRoadColl = F11_CityRoadColl.GetF11_CityRoadColl(dal.F11_CityRoadColl);

            f11_CityRoadColl.LoadItems(f09_CityColl);
        }
        /// <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 = F03_Continent_Child.GetF03_Continent_Child(dr);
                var obj   = ((F01_ContinentColl)Parent).FindF02_ContinentByParentProperties(child.continent_ID1);
                obj.LoadProperty(F03_Continent_SingleObjectProperty, child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = F03_Continent_ReChild.GetF03_Continent_ReChild(dr);
                var obj   = ((F01_ContinentColl)Parent).FindF02_ContinentByParentProperties(child.continent_ID2);
                obj.LoadProperty(F03_Continent_ASingleObjectProperty, child);
            }
            dr.NextResult();
            var f03_SubContinentColl = F03_SubContinentColl.GetF03_SubContinentColl(dr);

            f03_SubContinentColl.LoadItems((F01_ContinentColl)Parent);
            dr.NextResult();
            while (dr.Read())
            {
                var child = F05_SubContinent_Child.GetF05_SubContinent_Child(dr);
                var obj   = f03_SubContinentColl.FindF04_SubContinentByParentProperties(child.subContinent_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = F05_SubContinent_ReChild.GetF05_SubContinent_ReChild(dr);
                var obj   = f03_SubContinentColl.FindF04_SubContinentByParentProperties(child.subContinent_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var f05_CountryColl = F05_CountryColl.GetF05_CountryColl(dr);

            f05_CountryColl.LoadItems(f03_SubContinentColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = F07_Country_Child.GetF07_Country_Child(dr);
                var obj   = f05_CountryColl.FindF06_CountryByParentProperties(child.country_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = F07_Country_ReChild.GetF07_Country_ReChild(dr);
                var obj   = f05_CountryColl.FindF06_CountryByParentProperties(child.country_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var f07_RegionColl = F07_RegionColl.GetF07_RegionColl(dr);

            f07_RegionColl.LoadItems(f05_CountryColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = F09_Region_Child.GetF09_Region_Child(dr);
                var obj   = f07_RegionColl.FindF08_RegionByParentProperties(child.region_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = F09_Region_ReChild.GetF09_Region_ReChild(dr);
                var obj   = f07_RegionColl.FindF08_RegionByParentProperties(child.region_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var f09_CityColl = F09_CityColl.GetF09_CityColl(dr);

            f09_CityColl.LoadItems(f07_RegionColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = F11_City_Child.GetF11_City_Child(dr);
                var obj   = f09_CityColl.FindF10_CityByParentProperties(child.city_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = F11_City_ReChild.GetF11_City_ReChild(dr);
                var obj   = f09_CityColl.FindF10_CityByParentProperties(child.city_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var f11_CityRoadColl = F11_CityRoadColl.GetF11_CityRoadColl(dr);

            f11_CityRoadColl.LoadItems(f09_CityColl);
        }