Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to assign cacheItemUpdateCallBack to cache
    primarykey
    data
    text
    <p>I am developing an eCommerce website in which user will buy the product. for the i have made a cache and add the item to cache. i have made the usercontrol of product with the add button(for buy the product which add the item to cart). add button will call the fallowing method</p> <pre><code>public void itemAddTocart(string[] arg, int itemQty) { CartDT=(DataTable)Cache["Cart"]; if (CartDT==null) { DataTableColumn(); } DataRow dr = CartDT.NewRow(); dr[0] = arg[0]; //Product_Name dr[1] = arg[1]; //Product_ID dr[2] = itemQty; //OrderQTY dr[3] = Math.Round(Convert.ToDouble(arg[2])).ToString(); //Price dr[4] = (Double.Parse(arg[2]) * itemQty).ToString(); // calculate total price dr[5] = 0; dr[6] = "default"; dr[7] = Convert.ToInt32(arg[3]); dr[8] = arg[4]; dr[9] = arg[5]; dr[10] = arg[6]; dr[11] = Convert.ToInt32(Session["MinorderAmount"].ToString()); CartDT.Rows.Add(dr); //CartDT.DefaultView.Sort = "SuppEmailID"; Cache["cart"] = CartDT; } </code></pre> <p>but after adding item to cart have to show the changes in cart to user for that i am refresh the whole page so the the code in page load will populate the cart which will be take long time which will not good for user am doing so because this event is trigger from user control so that i do not have the access the page control </p> <p>so that i have decide to call the method which will be trigger when cache is update by using <strong>CacheItemUpdateCallback delegate</strong> </p> <p>which will be added as </p> <p>Create Deligate </p> <pre><code>CacheItemUpdateCallback CacheItemUpdateCallbackDel=new CacheItemUpdateCallback (CacheItemUpdateCallbackMethod); </code></pre> <p>Add it</p> <pre><code> Cache.Insert("ProductData", PD, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemUpdateCallbackDel); </code></pre> <p>Method</p> <pre><code>public void CacheItemUpdateCallbackMethod(string key, CacheItemUpdateReason reason, out object expensiveObject, out CacheDependency dependency, out DateTime absoluteExpiration, out TimeSpan slidingExpiration) { setCartSuppWise(); } </code></pre> <p>but it gives me the error </p> <p><strong>The out parameter 'expensiveObject' must be assigned to before control leaves the current method</strong></p> <p><strong>The out parameter 'dependency' must be assigned to before control leaves the current method</strong></p> <p><strong>The out parameter 'absoluteExpiration' must be assigned to before control leaves the current method</strong></p> <p><strong>The out parameter 'slidingExpiration' must be assigned to before control leaves the current method</strong></p> <p>am first time working with the cache so i may have been make the mistake or may be making wrong concept so please help me to solve this problem</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload