New Posts New Posts RSS Feed: The FakeBackingStore isn't reset when we hit F5 ?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

The FakeBackingStore isn't reset when we hit F5 ?

 Post Reply Post Reply
Author
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Topic: The FakeBackingStore isn't reset when we hit F5 ?
    Posted: 03-May-2012 at 6:53am
Hi,

I am experimenting a strange behavior with the faking. When I hit F5, sometimes (I can't always reproduce it), the data I previously saved in the fakinstore are still here in the new session of my application.
After hitting F5, the SampleDataProviders correctly fill the manager but at the end when I query it I get "extra" entities coming from my previous session.

How is that possible ? 


Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 03-May-2012 at 9:16am
Are you doing Silverlight or n-tier WPF? If so, the fake store is kept on the server. Visual Studio leaves the server running between debug sessions, so the fake store stays alive. If you want clear slate, you have to manually stop the server process.
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 03-May-2012 at 9:20am
Silverlight !

Ok that explain all, I lost a lot of time figuring what was wrong on this one. 
I think it might worth an litttle addition to the documentation so everyone knows about it.


Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 03-May-2012 at 10:01am
I probably should actually clear all the data before loading the new data. I'll see if I can sneak this in before I release v0.6 shortly.
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 03-May-2012 at 11:39am
The fix is in. 
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 03-May-2012 at 11:40am
thank you
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 03-May-2012 at 12:05pm
I tested the fix. 
In 30 attempts, I reproduced the problem 4 times.

Edit : To be sure I did a clean compile (deleted all the obj/bin folders) and the problem still exist 



Edited by Walid - 03-May-2012 at 12:39pm
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 03-May-2012 at 1:54pm
I can't reproduce this. For kicks I added the following action in TempHire that allows me to reset the fake backing store by the click of a button and it resets it back to the initial state every time, provided obviously that I wait for the prompt before querying since reseting the backing store asynchronous.
 
Are you sure that your app waits for the initialization/reset of the backing store to complete before it runs the first query?
 
        public IEnumerable<IResult> ResetData()
        {
            var provider = Composition.GetInstance<IEntityManagerProvider<TempHireEntities>>();
            yield return provider.ResetFakeBackingStoreAsync();
 
            var dialogManager = Composition.GetInstance<IDialogManager>();
            yield return dialogManager.ShowMessageAsync("Data has been reset"DialogButtons.Ok);
        }
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 04-May-2012 at 6:30am
You were right.

The fakestore initialization is in the login viewmodel (like temphire) but the data were loaded in the OnLoggedIn of the AuthenticationService. 
I moved it to the Login VM.

Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 04-May-2012 at 9:20am
In Cocktail v0.1 the fake store initialization used to be implicit, but that all changed in Cocktail v0.2 and since then TempHire initializes the fake store in the Bootstrapper. I don't believe I ever had it in the Login VM. The data preloading is done in the Login VM, but not the fake store initialization.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down