New Posts New Posts RSS Feed: Fake Backing Store
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Fake Backing Store

 Post Reply Post Reply
Author
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 Topic: Fake Backing Store
    Posted: 09-May-2012 at 1:17pm
I've just upgraded a project to the latest cocktail and I'm having issues getting the fake backing store to work

    public class AppBootstrapper : FrameworkBootstrapper<ShellViewModel>
    {
#if FAKESTORE
        [Import]
        public IEntityManagerProvider<VITEntities> EntityManagerProvider;
 
        protected override IEnumerable<IResult> StartRuntimeAsync()
        {
            yield return EntityManagerProvider.InitializeFakeBackingStoreAsync();
        }
#endif
 
    }

InitializeFakeBackingStoreAsync() never completes. I've traced it down to FakeBackingStore.ResetCore.

I'm not getting any errors whatsoever, it just doesn't return, so the shell doesn't show. Any suggestions on what I can try?
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: 09-May-2012 at 3:07pm

My first instinct is your UI thread might be blocked, so the callback can't be processed.

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: 09-May-2012 at 3:11pm
I'm not sure how that could be possible as this is being called from the bootstrapper, before anything else has happened.
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: 09-May-2012 at 3:20pm
Is the above your entire bootstrapper? StartRuntimeAsync is called from StartRuntime. Are you doing anything in StartRuntime?
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: 09-May-2012 at 3:22pm
That is the entire bootstrapper, copied from TempHire. I can set a breakpoint on connect and it hits ConnectAsync in ResetCore but it never hits Store.ClearAsync()

I also tested this without the fake store and it is connecting just fine.


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: 09-May-2012 at 3:31pm
That's odd. I assume TempHire works on your machine?
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: 10-May-2012 at 9:02am
Yes, it appears to work fine in TempHire (I upgraded TempHire to SL5 to make sure both are using the exact same environment)


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: 10-May-2012 at 10:20am
How is your EnityManager being created? The latest TempHire uses an unmodified EntityManagerProvider and the out-of-the-box fake ConnectionOptions:
 
        [Export]
        public IEntityManagerProvider<TempHireEntities> TempHireEntityManagerProvider
        {
            get
            {
                var provider = new EntityManagerProvider<TempHireEntities>();
#if FAKESTORE
                provider.Configure(config => config.WithConnectionOptions(ConnectionOptions.Fake.Name));
#endif
                return provider;
            }
        }

Then on the server it injects the FakeLoginManager into the existing fake CompositionContext:
 
    public class CompositionContextResolver : ICompositionContextResolver
    {
        private static readonly CompositionContext TempHireFake = CompositionContext.Fake
            .WithGenerator(typeof(FakeLoginManager))
            .WithName(CompositionContext.Fake.Name);

        #region ICompositionContextResolver Members

        public CompositionContext GetCompositionContext(string compositionContextName)
        {
            // Overwriting the default fake composition context.           
            if (compositionContextName == CompositionContext.Fake.Name)
                return TempHireFake;

            return null;
        }

        #endregion
    }
Thanks to a bug fix in DF 6.1.7, this much simpler approach now works n-tier as well, if you just want to add a few things to an existing out-of-the-box CompositionContext.
 
What's different in your app? Perhaps the bug fix had an unintentended side effect. Are you hooking into any EM events outside of the EntityManagerDelegate?
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: 10-May-2012 at 12:34pm
I'm using 6.1.6 at the moment. I ended up making a new project and all seems to work... No idea what the problem was.
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: 10-May-2012 at 1:27pm
Cocktail 0.6 doesn't work with 6.1.6 at least not fully. The system requirements do state that you need 6.1.7. First of all the binaries are built against 6.1.7 and you'll get into conflicts eventually if you try to use them against 6.1.6. It may seem to work up to a certain point. Second, the latest Cocktail relies on bug fixes in 6.1.7.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down