/// <summary> /// Clears the in-memory UserAllNVL cache so it is reloaded on the next request. /// </summary> public static void InvalidateCache() { if (!CanGetObject()) { throw new System.Security.SecurityException("User not authorized to load a UserAllNVL."); } _list = null; }
/// <summary> /// Factory method. Loads a <see cref="UserAllNVL"/> object. /// </summary> /// <returns>A reference to the fetched <see cref="UserAllNVL"/> object.</returns> public static UserAllNVL GetUserAllNVL() { if (!CanGetObject()) { throw new System.Security.SecurityException("User not authorized to load a UserAllNVL."); } if (_list == null) { _list = DataPortal.Fetch <UserAllNVL>(); } return(_list); }
/// <summary> /// Factory method. Asynchronously loads a <see cref="UserAllNVL"/> object. /// </summary> /// <param name="callback">The completion callback method.</param> public static void GetUserAllNVL(EventHandler <DataPortalResult <UserAllNVL> > callback) { if (!CanGetObject()) { throw new System.Security.SecurityException("User not authorized to load a UserAllNVL."); } if (_list == null) { DataPortal.BeginFetch <UserAllNVL>((o, e) => { _list = e.Object; callback(o, e); }); } else { callback(null, new DataPortalResult <UserAllNVL>(_list, null, null)); } }
/// <summary> /// Loads a <see cref="UserAllNVL"/> 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("GetUserAllNVL", 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(UserAllNVL list) { _list = list; }