/// <summary> /// Factory method. Loads a <see cref="UserNVL"/> object. /// </summary> /// <returns>A reference to the fetched <see cref="UserNVL"/> object.</returns> public static UserNVL GetUserNVL() { if (_list == null) { _list = DataPortal.Fetch <UserNVL>(); } return(_list); }
/// <summary> /// Factory method. Asynchronously loads a <see cref="UserNVL"/> object. /// </summary> /// <param name="callback">The completion callback method.</param> public static void GetUserNVL(EventHandler <DataPortalResult <UserNVL> > callback) { if (_list == null) { DataPortal.BeginFetch <UserNVL>((o, e) => { _list = e.Object; callback(o, e); }); } else { callback(null, new DataPortalResult <UserNVL>(_list, null, null)); } }
/// <summary> /// Loads a <see cref="UserNVL"/> collection from the database or from the cache. /// </summary> protected void DataPortal_Fetch() { if (IsCached) { LoadCachedList(); return; } using (var cn = new SqlConnection(Database.DocStoreConnection)) { using (var cmd = new SqlCommand("GetUserNVL", cn)) { cmd.CommandType = CommandType.StoredProcedure; cn.Open(); var args = new DataPortalHookArgs(cmd); OnFetchPre(args); LoadCollection(cmd); OnFetchPost(args); } } _list = this; }
/// <summary> /// Used by async loaders to load the cache. /// </summary> /// <param name="list">The list to cache.</param> internal static void SetCache(UserNVL list) { _list = list; }
/// <summary> /// Clears the in-memory UserNVL cache so it is reloaded on the next request. /// </summary> public static void InvalidateCache() { _list = null; }