New Posts New Posts RSS Feed: Inserted Item not Updating
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Inserted Item not Updating

 Post Reply Post Reply
Author
yimbot View Drop Down
Newbie
Newbie


Joined: 15-Jan-2011
Posts: 10
Post Options Post Options   Quote yimbot Quote  Post ReplyReply Direct Link To This Post Topic: Inserted Item not Updating
    Posted: 25-Jan-2011 at 5:40am
Great info. Thanks for your replies!
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 24-Jan-2011 at 12:34pm
I should have added that when QueryStrategy.Normal is used, if a query has been seen before DevForce will assume that the next time the query is run it can be satisfied entirely from cache.  smi-mark is correct that to override this behavior you can use QueryStrategy.DataSourceOnly.  Here's more information on the subject - http://drc.ideablade.com/xwiki/bin/view/Documentation/EntityCaching.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 23-Jan-2011 at 11:15am
If you always want to go back to the SQL Server for this query, try changing:
var query = Mgr.Widgets.Where(a => a.UserID == CurrentUserID);

to

var query = Mgr.Widgets.Where(a => a.UserID == CurrentUserID).With(QueryStrategy.DataSourceOnly);

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jan-2011 at 9:05pm
Has the em.DefaultQueryStrategy been set to CacheOnly?
Back to Top
yimbot View Drop Down
Newbie
Newbie


Joined: 15-Jan-2011
Posts: 10
Post Options Post Options   Quote yimbot Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jan-2011 at 3:25pm
Any ideas or suggestions as to where this might be failing?
Back to Top
yimbot View Drop Down
Newbie
Newbie


Joined: 15-Jan-2011
Posts: 10
Post Options Post Options   Quote yimbot Quote  Post ReplyReply Direct Link To This Post Posted: 20-Jan-2011 at 5:53am
An interesting problem...
 
When first loading a page, I call the GetWidgets Method to and bind the reults as an item source of a combo box. Works fine.
If i then add a widget to the database by any method (even through SQL Management studio) and execute my query again, it does not find the new item added.
 
This is my GetWidgets Method
 
        public void GetWidgets()
        {
                IsBusy = true;
                WidgetsList.Clear();
                var query = Mgr.Widgets.Where(a => a.UserID == CurrentUserID);
                query.ExecuteAsync(op =>
                                       {
                                           if (op.HasError)
                                           {
                                               MessageBoxServiceProvider.ShowError("Unable to retrive your Widgets",
                                                                                   "Widget Error");
                                               op.MarkErrorAsHandled();
                                           }
                                           else
                                           {
                                               op.Results.ForEach(WidgetsList.Add);
                                           }
                                           IsBusy = false;
                                       });
            }
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down