locked
SL Client: Can't resolve QueryStringHelper after March 2014 upgrade RRS feed

  • Question

  • I recently upgraded a project to the March 2014 tooling.  This project had a Silverlight client with code in the Application.cs file that used QueryStringHelper, using Microsoft.LightSwitch.ApplicationInfrastructure.Utilities.Internal;  This worked fine before the upgrade, but since the upgrade, QueryStringHelper used in my method does not exist in the current context, code won't compile.  I was using it per one of Jewel Lambert's blog posts:

    		string screenName = null;
             	string idString = null;
    
                    // Get parameters out of the querystring
    
                    QueryStringHelper.TryGetValue("screen", out screenName);
                    QueryStringHelper.TryGetValue("id", out idString);
    

    Friday, April 4, 2014 8:33 PM

Answers

  • You can parse the query string from the uri yourself:

    Uri uri;
    if (HtmlPage.IsEnabled)
    {
        uri = HtmlPage.Document.DocumentUri;
    }
    else
    {
        uri = Application.Current.Host.Source;
    }
    FYI, you probably have to do this on the main thread.


    Justin Anderson, LightSwitch Development Team

    • Marked as answer by Angie Xu Monday, April 14, 2014 2:01 AM
    Thursday, April 10, 2014 5:31 PM
    Moderator

All replies

  • QueryStringHelper is an infrastructure class only meant to be used by the LightSwitch framework and not by your code (hence it is in an "internal" namespace: Microsoft.LightSwitch.ApplicationInfrastructure.Utilities.Internal).

    That being said, it was removed from the runtime in the March 2014 Update.


    Justin Anderson, LightSwitch Development Team


    Monday, April 7, 2014 7:46 PM
    Moderator
  • Is there another solution for deeplinking screens or entities in the Silverlight client?
    Thursday, April 10, 2014 4:29 PM
  • You can parse the query string from the uri yourself:

    Uri uri;
    if (HtmlPage.IsEnabled)
    {
        uri = HtmlPage.Document.DocumentUri;
    }
    else
    {
        uri = Application.Current.Host.Source;
    }
    FYI, you probably have to do this on the main thread.


    Justin Anderson, LightSwitch Development Team

    • Marked as answer by Angie Xu Monday, April 14, 2014 2:01 AM
    Thursday, April 10, 2014 5:31 PM
    Moderator
  • Justin In my Silverlight Web Application I tried the following and it appears that Host is not part of Application.Current.

    Dispatchers.Main.Invoke(() => {
    Uri uri = Application.Current.Host.Source;
    });

    
    

    Any suggestions?

    Cliff

    Tuesday, June 16, 2015 12:47 AM