/// <summary> /// Gets the lookup codes by type id. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> public static LookupCodes GetLookupCodesByTypeId(int id) { if (_lazyCache == null) { lock (CacheSynch) { if (_lazyCache == null) { _lazyCache = new Dictionary <string, LookupCodes>(); } } } if (_lazyCache.ContainsKey(id.ToString(CultureInfo.InvariantCulture))) { var result = _lazyCache[id.ToString(CultureInfo.InvariantCulture)]; result.Reset(); return(result); } var codes = new LookupCodes { CodeTypeId = id.ToString(CultureInfo.InvariantCulture) }; if (!codes.Execute()) { return(codes); } lock (_lazyCache) { _lazyCache.Add(id.ToString(CultureInfo.InvariantCulture), codes); } return(codes); }
/// <summary> /// Lookups the by type id. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> static public IEnumerable <LookupCode> LookupByTypeId(string id) { var codes = new LookupCodes { CodeTypeId = id }; if (!codes.Execute()) { } else { foreach (var c in codes) { yield return(c); } } }