Print Page | Close Window

The FakeBackingStore isn't reset when we hit F5 ?

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3422
Printed Date: 28-Apr-2024 at 6:36am


Topic: The FakeBackingStore isn't reset when we hit F5 ?
Posted By: Walid
Subject: The FakeBackingStore isn't reset when we hit F5 ?
Date 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 ? 





Replies:
Posted By: mgood
Date 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.


Posted By: Walid
Date 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.




-------------


Posted By: mgood
Date 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.


Posted By: mgood
Date Posted: 03-May-2012 at 11:39am
The fix is in. 


Posted By: Walid
Date Posted: 03-May-2012 at 11:40am
thank you

-------------


Posted By: Walid
Date 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 



-------------


Posted By: mgood
Date 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);
        }


Posted By: Walid
Date 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.



-------------


Posted By: mgood
Date 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.



Print Page | Close Window