/// <summary> /// Factory method. Asynchronously creates a new <see cref="DocEditGetter"/> unit of objects. /// </summary> /// <param name="callback">The completion callback method.</param> public static void NewDocEditGetter(EventHandler <DataPortalResult <DocEditGetter> > callback) { // DataPortal_Fetch is used as ReadOnlyBase<T> doesn't allow the use of DataPortal_Create. DataPortal.BeginFetch <DocEditGetter>(new Criteria1(true, new int()), (o, e) => { if (e.Error != null) { throw e.Error; } if (!DocClassNVL.IsCached) { DocClassNVL.SetCache(e.Object.DocClassNVL); } if (!DocTypeNVL.IsCached) { DocTypeNVL.SetCache(e.Object.DocTypeNVL); } if (!DocStatusNVL.IsCached) { DocStatusNVL.SetCache(e.Object.DocStatusNVL); } if (!UserNVL.IsCached) { UserNVL.SetCache(e.Object.UserNVL); } callback(o, e); }); }
/// <summary> /// Factory method. Asynchronously loads a <see cref="DocEditGetter"/> unit of objects, based on given parameters. /// </summary> /// <param name="docID">The DocID parameter of the DocEditGetter to fetch.</param> /// <param name="callback">The completion callback method.</param> public static void GetDocEditGetter(int docID, EventHandler <DataPortalResult <DocEditGetter> > callback) { DataPortal.BeginFetch <DocEditGetter>(new Criteria1(false, docID), (o, e) => { if (e.Error != null) { throw e.Error; } if (!DocClassNVL.IsCached) { DocClassNVL.SetCache(e.Object.DocClassNVL); } if (!DocTypeNVL.IsCached) { DocTypeNVL.SetCache(e.Object.DocTypeNVL); } if (!DocStatusNVL.IsCached) { DocStatusNVL.SetCache(e.Object.DocStatusNVL); } if (!UserNVL.IsCached) { UserNVL.SetCache(e.Object.UserNVL); } callback(o, e); }); }
/// <summary> /// Loads a <see cref="DocListGetter"/> unit of objects, based on given criteria. /// </summary> /// <param name="docListFilteredCriteria">The fetch criteria.</param> protected void DataPortal_Fetch(DocListFilteredCriteria docListFilteredCriteria) { LoadProperty(DocListProperty, DocList.GetDocList(docListFilteredCriteria)); LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL()); LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL()); LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL()); LoadProperty(UserNVLProperty, UserNVL.GetUserNVL()); }
/// <summary> /// Loads a <see cref="DocListGetter"/> unit of objects. /// </summary> protected void DataPortal_Fetch() { LoadProperty(DocListProperty, DocList.GetDocList()); LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL()); LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL()); LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL()); LoadProperty(UserNVLProperty, UserNVL.GetUserNVL()); }
/// <summary> /// Loads a <see cref="DocEditUoWGetter"/> unit of objects, based on given criteria. /// </summary> /// <param name="docID">The fetch criteria.</param> protected void DataPortal_Fetch(int docID) { LoadProperty(DocProperty, Doc.GetDoc(docID)); LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL()); LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL()); LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL()); LoadProperty(UserNVLProperty, UserNVL.GetUserNVL()); }
/// <summary> /// Factory method. Loads a <see cref="DocClassNVL"/> object. /// </summary> /// <returns>A reference to the fetched <see cref="DocClassNVL"/> object.</returns> public static DocClassNVL GetDocClassNVL() { if (_list == null) { _list = DataPortal.Fetch <DocClassNVL>(); } 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 DocClassList.InvalidateCache(); DocClassNVL.InvalidateCache(); } }
/// <summary> /// Creates or loads a <see cref="DocEditGetter"/> unit of objects, based on given criteria. /// </summary> /// <param name="crit">The create/fetch criteria.</param> protected void DataPortal_Fetch(Criteria1 crit) { if (crit.CreateDoc) { LoadProperty(DocProperty, Doc.NewDoc()); } else { LoadProperty(DocProperty, Doc.GetDoc(crit.DocID)); } LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL()); LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL()); LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL()); LoadProperty(UserNVLProperty, UserNVL.GetUserNVL()); }
/// <summary> /// Factory method. Asynchronously loads a <see cref="DocClassNVL"/> object. /// </summary> /// <param name="callback">The completion callback method.</param> public static void GetDocClassNVL(EventHandler <DataPortalResult <DocClassNVL> > callback) { if (_list == null) { DataPortal.BeginFetch <DocClassNVL>((o, e) => { _list = e.Object; callback(o, e); }); } else { callback(null, new DataPortalResult <DocClassNVL>(_list, null, null)); } }
/// <summary> /// Loads a <see cref="DocClassNVL"/> 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("GetDocClassNVL", 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(DocClassNVL list) { _list = list; }
/// <summary> /// Clears the in-memory DocClassNVL cache so it is reloaded on the next request. /// </summary> public static void InvalidateCache() { _list = null; }
private void OnDocClassEditSaved(object sender, Csla.Core.SavedEventArgs e) { // this runs on the client DocClassList.InvalidateCache(); DocClassNVL.InvalidateCache(); }