Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

GlobalContext value from Silverlight client to DAL

$
0
0

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.

 


Viewing all articles
Browse latest Browse all 764

Trending Articles