/// <summary> /// Factory method. Loads a <see cref="DocTypeNVL"/> object. /// </summary> /// <returns>A reference to the fetched <see cref="DocTypeNVL"/> object.</returns> public static DocTypeNVL GetDocTypeNVL() { if (_list == null) { _list = DataPortal.Fetch <DocTypeNVL>(); } return(_list); }
/// <summary> /// Called by the server-side DataPortal after calling the requested DataPortal_XYZ method. /// </summary> /// <param name="e">The DataPortalContext object passed to the DataPortal.</param> protected override void DataPortal_OnDataPortalInvokeComplete(Csla.DataPortalEventArgs e) { if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Server && e.Operation == DataPortalOperations.Update) { // this runs on the server DocTypeList.InvalidateCache(); DocTypeNVL.InvalidateCache(); } }
/// <summary> /// Loads a <see cref="DocTypeNVL"/> collection from the database or from the cache. /// </summary> protected void DataPortal_Fetch() { if (IsCached) { LoadCachedList(); return; } using (var cn = new SqlConnection(Database.TestProjectConnection)) { using (var cmd = new SqlCommand("GetDocTypeNVL", cn)) { cmd.CommandType = CommandType.StoredProcedure; cn.Open(); var args = new DataPortalHookArgs(cmd); OnFetchPre(args); LoadCollection(cmd); OnFetchPost(args); } } _list = this; }
private void OnDocTypeEditCollSaved(object sender, Csla.Core.SavedEventArgs e) { // this runs on the client DocTypeList.InvalidateCache(); DocTypeNVL.InvalidateCache(); }
/// <summary> /// Used by async loaders to load the cache. /// </summary> /// <param name="list">The list to cache.</param> internal static void SetCache(DocTypeNVL list) { _list = list; }
/// <summary> /// Clears the in-memory DocTypeNVL cache so it is reloaded on the next request. /// </summary> public static void InvalidateCache() { _list = null; }