Inheritance: IGeoCountry
Example #1
0
        public static GeoCountry FromIGeoCountry(IGeoCountry igeo)
        {
            GeoCountry country = new GeoCountry();
            country.Guid = igeo.Guid;
            country.ISOCode2 = igeo.ISOCode2;
            country.ISOCode3 = igeo.ISOCode3;
            country.Name = igeo.Name;

            return country;
        }
        public async Task<IGeoCountry> FetchCountry(string isoCode2)
        {
            using (DbDataReader reader = await dbGeoCountry.GetByISOCode2(isoCode2))
            {
                if (reader.Read())
                {
                    GeoCountry geoCountry = new GeoCountry();
                    LoadFromReader(reader, geoCountry);
                    return geoCountry;

                }
            }

            return null;
        }
        /// <param name="guid"> guid </param>
        public async Task<IGeoCountry> FetchCountry(Guid guid)
        {
            using (DbDataReader reader = await dbGeoCountry.GetOne(guid))
            {
                if (reader.Read())
                {
                    GeoCountry geoCountry = new GeoCountry();
                    LoadFromReader(reader, geoCountry);
                    return geoCountry;

                }
            }

            return null;
        }
        private List<IGeoCountry> LoadCountryListFromReader(DbDataReader reader)
        {
            List<IGeoCountry> geoCountryList = new List<IGeoCountry>();

            using(reader)
            {
                while (reader.Read())
                {
                    GeoCountry geoCountry = new GeoCountry();
                    LoadFromReader(reader, geoCountry);
                    geoCountryList.Add(geoCountry);

                }
            }
            
            return geoCountryList;

        }
Example #5
0
        /// <param name="guid"> guid </param>
        public async Task<IGeoCountry> FetchCountry(
            Guid guid, 
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            using (DbDataReader reader = dbGeoCountry.GetOne(guid))
            {
                if (reader.Read())
                {
                    GeoCountry geoCountry = new GeoCountry();
                    LoadFromReader(reader, geoCountry);
                    return geoCountry;

                }
            }

            return null;
        }
Example #6
0
        public async Task<IGeoCountry> FetchCountry(
            string isoCode2, 
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            using (DbDataReader reader = await dbGeoCountry.GetByISOCode2(isoCode2, cancellationToken))
            {
                if (reader.Read())
                {
                    GeoCountry geoCountry = new GeoCountry();
                    LoadFromReader(reader, geoCountry);
                    return geoCountry;

                }
            }

            return null;
        }