CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum


CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • The case of the ApplicationContext.ClientContext disappearance

    rated by 0 users
    Answered (Not Verified) This post has 0 verified answers | 32 Replies | 2 Followers

    Top 150 Contributor
    60 Posts
    Jean posted on Mon, Jun 17 2013 10:46 PM

    It seems that the content of ApplicationContext.ClientContext disappear .  During the login proess i put the user id in the clientContext, then i use my implementation of IAuthorizeDataPortal to recreate the user and get the stuff i need from it.   Now this is working fine for a couple of back and forth and than suddenly no more userID in the ClientContext, this can happen at any time, i there seems to have no pattern.

     

    By reading the previous post, a recurring anwser is make sure you have the csla web in the folder, and i do.

     

    i'm using Win8 with CSLA Core.4.5.30. on .net 4.5

    All Replies

    Top 10 Contributor
    2,279 Posts
    JonnyBee replied on Mon, Jun 17 2013 11:09 PM

    Which UI technology do you use? 

    Jonny Bekkum, Norway CslaContrib Coordinator

    Top 150 Contributor
    60 Posts
    Jean replied on Tue, Jun 18 2013 7:02 AM
    We are using xaml and,c#
    Top 10 Contributor
    2,279 Posts
    Suggested by JonnyBee

    Hi,

    For WPF you must make sure that Csla.Xaml.dll is present in your bin folder. 

    Jonny Bekkum, Norway CslaContrib Coordinator

    Top 150 Contributor
    60 Posts
    Jean replied on Tue, Jun 18 2013 9:32 AM

    We are using XAML C#  on  Windows 8  and we do have CSLA.xaml.dll in the .Net for Windows Store Apps 

    Top 150 Contributor
    60 Posts
    Jean replied on Thu, Jun 20 2013 3:19 PM

    When i say windows 8 i mean Windows Store Apps and we do have the csla.xaml in the Windows Store App referecnces

    Top 10 Contributor
    9,475 Posts

    Is the ClientContext being lost on the client, or is it just not making it to the server via the data portal?

    Rocky

    Top 150 Contributor
    60 Posts
    Jean replied on Fri, Jun 21 2013 12:23 PM

    seems to have been lost on the client as well :-\

    Top 150 Contributor
    60 Posts
    Jean replied on Sun, Jun 30 2013 12:25 PM

    it seems to be happening only or more during development then when running the application.

    Top 10 Contributor
    9,475 Posts

    In WinRT the application context values are stored in a static fields, so they are global to the app. This does mean that changes to the values on background threads are global to the app. It also means that if the appdomain is reset somehow that the values would be lost. I don't know how _that_ would happen in WinRT though.

    Rocky

    Top 10 Contributor
    2,279 Posts

    Hi,

    I kinda suspect there is at least 2 other possible explanations as having applicationcontext in static variables breaks the DataPortal logic for SetContext  / ClearContext when running in local mode. 

    1. Making 2 async DataPortal calls in parallel will make the second call start with ExecutionLocations.Server and then call  ClearContext when complete. 

    2. Calling f.ex a new DataPortal.Fetch method from within another DataPortal.Fetch will make the second call start  with ExecutionLocations.Server and then call  ClearContext when complete.

    Jonny Bekkum, Norway CslaContrib Coordinator

    Top 10 Contributor
    9,475 Posts

    You are probably right. And there's no easy solution because we have no access to TLS or ExecutionContext. As a result I do have an issue in the backlog on GitHub to develop my own equivalent to ExecutionContext for use in WinRT. I guess the priority of that issue should be elevated... 

    Rocky

    Top 10 Contributor
    2,279 Posts

    Been digging into the code and it does not seem to be the issue. 

    There is an extra check for context.IsRemote before the ApplicationContext.Clear() so I am not able to recreate the issue.

    Jonny Bekkum, Norway CslaContrib Coordinator

    Top 150 Contributor
    60 Posts
    Jean replied on Thu, May 21 2015 6:12 PM

    after all these years Wink, i'm still having the issue, as you said JonnyBee it seem to be happening a lot more when i do a DataPortal.Fetch inside another DataPortal.Fetch but it is very strange, as it does not happen all the time and at the same place????

     

     

    Top 150 Contributor
    60 Posts
    Jean replied on Fri, May 22 2015 3:02 PM

    By digging a bit more it seem to be happening when there is more than one Dataportal call coming from the WinRT app at some point it looses the ApplicationContext.ClientContext in the backend ???? 

    Page 1 of 3 (33 items) 1 2 3 Next > | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems