Hi,
Does anyone know if would be possible to switch the DataPortal inside the application? What I mean is that I have an offline smart client that uses the local DataPortal to load the BOs from a local SQL Express DB. The data is downloaded from a remote server using Sync Framework. Unfortunately, I also have to do some updates on the remote server and I don’t want to put in the local app config a connectionstring to point to the remote SQL Server for the update. All I want is a magic “switch” to change the DataPortal from local to WCF for example to call my BO that will update the remote data store. Any ideas?
Kind regards,
George B
Proper solution would be a custom proxy / portal. If you
want a quick and dirty way, you can write to configuration managers settings as
in:
ConfigurationManager.AppSettings["CslaDataPortalProxy"]
= “Local” or
ConfigurationManager.AppSettings["CslaDataPortalProxy"]
= " Csla.DataPortalClient.WcfProxy,
Csla"
Make sure you will never save the settings though. The
code above will only write settings to memory for duration of current session/application.
You have to be aware that this code will not be thread safe, so if you have
multi-threaded app, this will now work properly. Also, at some point framework
use to cache proxy type, but I am not sure when this behavior changed. I
know, it will work in 3.6 though.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Magenic ®
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: ixman
[mailto:cslanet@lhotka.net]
Sent: Monday, October 06, 2008 9:05 AM
To: Sergey Barskiy
Subject: [CSLA .NET] DataPortal switch?
Hi,
Does
anyone know if would be possible to switch the DataPortal inside the
application? What I mean is that I have an offline smart client that uses the
local DataPortal to load the BOs from a local SQL Express DB. The data is downloaded
from a remote server using Sync Framework. Unfortunately, I also have to do
some updates on the remote server and I don???t want to put in the local app
config a connectionstring to point to the remote SQL Server for the update. All
I want is a magic ???switch??? to change the DataPortal from local to WCF for
example to call my BO that will update the remote data store. Any ideas?
Kind
regards,
George
B
Thanks,
I'll go with a custom DataPortal Proxy...
GB
Copyright (c) Marimer LLC