/// <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
         ProductTypeCachedNVL.InvalidateCache();
     }
 }
Exemple #2
0
        /// <summary>
        /// Factory method. Loads a <see cref="ProductTypeCachedNVL"/> object.
        /// </summary>
        /// <returns>A reference to the fetched <see cref="ProductTypeCachedNVL"/> object.</returns>
        public static ProductTypeCachedNVL GetProductTypeCachedNVL()
        {
            if (_list == null)
            {
                _list = DataPortal.Fetch <ProductTypeCachedNVL>();
            }

            return(_list);
        }
Exemple #3
0
 /// <summary>
 /// Factory method. Asynchronously loads a <see cref="ProductTypeCachedNVL"/> object.
 /// </summary>
 /// <param name="callback">The completion callback method.</param>
 public static void GetProductTypeCachedNVL(EventHandler <DataPortalResult <ProductTypeCachedNVL> > callback)
 {
     if (_list == null)
     {
         DataPortal.BeginFetch <ProductTypeCachedNVL>((o, e) =>
         {
             _list = e.Object;
             callback(o, e);
         });
     }
     else
     {
         callback(null, new DataPortalResult <ProductTypeCachedNVL>(_list, null, null));
     }
 }
Exemple #4
0
        /// <summary>
        /// Loads a <see cref="ProductTypeCachedNVL"/> collection from the database or from the cache.
        /// </summary>
        protected void DataPortal_Fetch()
        {
            if (IsCached)
            {
                LoadCachedList();
                return;
            }

            var args = new DataPortalHookArgs();

            OnFetchPre(args);
            using (var dalManager = DalFactoryInvoices.GetManager())
            {
                var dal  = dalManager.GetProvider <IProductTypeCachedNVLDal>();
                var data = dal.Fetch();
                LoadCollection(data);
            }
            OnFetchPost(args);
            _list = this;
        }
Exemple #5
0
        /// <summary>
        /// Loads a <see cref="ProductTypeCachedNVL"/> collection from the database or from the cache.
        /// </summary>
        protected void DataPortal_Fetch()
        {
            if (IsCached)
            {
                LoadCachedList();
                return;
            }

            using (var ctx = ConnectionManager <SqlConnection> .GetManager("Invoices"))
            {
                using (var cmd = new SqlCommand("dbo.GetProductTypeCachedNVL", ctx.Connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    var args = new DataPortalHookArgs(cmd);
                    OnFetchPre(args);
                    LoadCollection(cmd);
                    OnFetchPost(args);
                }
            }
            _list = this;
        }
Exemple #6
0
        // TODO: edit "ProductTypeColl.cs", uncomment the "OnDeserialized" method and add the following line:
        // TODO:     Saved += OnProductTypeCollSaved;

        private void OnProductTypeCollSaved(object sender, Csla.Core.SavedEventArgs e)
        {
            // this runs on the client
            ProductTypeCachedList.InvalidateCache();
            ProductTypeCachedNVL.InvalidateCache();
        }
Exemple #7
0
 /// <summary>
 /// Used by async loaders to load the cache.
 /// </summary>
 /// <param name="list">The list to cache.</param>
 internal static void SetCache(ProductTypeCachedNVL list)
 {
     _list = list;
 }
Exemple #8
0
 /// <summary>
 /// Clears the in-memory ProductTypeCachedNVL cache so it is reloaded on the next request.
 /// </summary>
 public static void InvalidateCache()
 {
     _list = null;
 }
        // TODO: edit "ProductTypeDynaItem.cs", uncomment the "OnDeserialized" method and add the following line:
        // TODO:     ProductTypeDynaItemSaved += ProductTypeDynaItemSavedHandler;

        private void ProductTypeDynaItemSavedHandler(object sender, Csla.Core.SavedEventArgs e)
        {
            // this runs on the client
            ProductTypeCachedList.InvalidateCache();
            ProductTypeCachedNVL.InvalidateCache();
        }