示例#1
0
        public Country GetCountry(CountryKey key)
        {
            Country country  = null;
            string  cacheKey = key == null ? "CountryKey_null" : key.GetCacheKey();

            if (key != null && !TryGetCacheData(cacheKey, out country, _cacheName))
            {
                country = GetCountryManager().GetCountry(key);
                SetCacheData(_cacheName, cacheKey, country);
            }
            return(country);
        }
示例#2
0
        /// <summary>
        /// Delete data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        public void Delete(CountryKey key)
        {
            if (key == null || key.Id == 0)
            {
                return;
            }

            var row = _dbContext.Table <CountryRow>().Where(m => m.Id == key.Id).FirstOrDefault();

            if (row != null)
            {
                _dbContext.Delete(row);
            }
        }
示例#3
0
        /// <summary>
        /// Get data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        /// <returns>read data</returns>
        public Country Get(CountryKey key)
        {
            if (key == null || key.Id == 0)
            {
                return(null);
            }

            var row = _dbContext.Table <CountryRow>().Where(m => m.Id == key.Id).FirstOrDefault();

            if (row != null)
            {
                return(CountryTransformer.ToBean(row));
            }
            return(null);
        }
        /// <summary>
        /// Delete data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        public void Delete(CountryKey key)
        {
            if (key == null || key.Id == 0)
            {
                return;
            }

            var row = _dbContext.Country.Where(m => m.Id == key.Id).FirstOrDefault();

            if (row != null)
            {
                _dbContext.Country.Remove(row);
                _dbContext.SaveChanges();
            }
        }
示例#5
0
 internal Country GetCountry(CountryKey key)
 {
     return(_module.Get(key));
 }
 public Country GetCountry(CountryKey key)
 {
     return(_module.Get(key));
 }