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
  • GlobalContext value from Silverlight client to DAL

    rated by 0 users
    Not Answered This post has 0 verified answers | 1 Reply | 1 Follower

    Top 500 Contributor
    24 Posts
    Hannes Pretorius posted on Wed, Jun 5 2013 2:01 AM

    Hi, In our application we would like to allow the user to choose a database via a dropdown box when he/she logs in.

    The application is a Silverlight application. Because the architecture of Silverlight is client/server we need to get the database name from the client with each request to query or manipulate the right database in the DAL.

    I can do this by changing my factory methods like below and pass the database right through to the DAL:

    public static void getCustomers(string Database, ...

    But we have a lot of factory methods and will take us forever to change each one of them and passing the database to the DAL.

    I thought that maybe I can use the Csla.ApplicationContext.GlobalContext to store the database value at client side (Silverlight) and then access the GlobalContext in my DAL.

    I have done this on my local machine and it actually works. I have tested it with multiple clients (browser instances) on my local PC and with each request it shows the database selected at client in the DAL.

    But when I deployed it to a remote server and tried to access it from my PC I got the error "Object not set to an instance...."

    What will be the best solution be to implement the multiple database function?

    Remember that I need to get the database name also with Inserts, Updates and Deletes.

     

    P.S. I found this question, but it explains how to send a value via GlobalContext from Server to Silverlight.

     

    All Replies

    Top 10 Contributor
    2,279 Posts

    Hi,

    My general recommendation would be to use the ApplicationContext.ClientContext rather than the GlobalContext as the GlobalContext is also included in the response. 

    The big question is why you get the exception. Do you have the stack trace? 

    Jonny Bekkum, Norway CslaContrib Coordinator

    Page 1 of 1 (2 items) | 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