We have an app.config file that contain our connection string and the dataportal settings. When the end-user logs in, they have the option to change the connection settings through a winforms UI.
Since the config file resides in the install folder, Windows dictates that by default you cannot write these files. This means that only an administrator can change the connection settings, which is becoming a pain for our end-users. It also violates Windows logo compliance as you're not supposed to modify files here.
I've experimented with creating external xml files for the config file to refer to, but these must still reside in the install folder, and thus still require admin.
The only way I can see to make it work under a non-admin account is to place the xml files in the end-users appsettings folder or the registry, which is fine, but it requires us to make a change to the ConnectionManager object in the core Csla dll's to attempt to read from there instead of the app.config.
I'm curious if anyone else has solved this problem.
Thanks,
Brian
ConnectionManager has overloads for GetManager that accepts the ConnectionString (and not just the name of the setting in app.config).
So you may place your connection strings wherever you like in your app and handle this in your own code.
Thanks Jonny. That will work for the connection string, which I can also move (using the file=connection.xml) to the public folder.
We also have settings that allow end-users to change the endpoint for the WCF connection to the dataportal (below). Unfortunately, WCF (in my limited testing here) doesn't allow these files to be moved outside of the folder where the app.config resides, meaning that the enduser still needs admin access to modify them. I can't see how to get around this one either... endpoint address=http://www.csladataportalhere.com/WcfPortal.svc
Hi,
If your first question gets answered please mark the tread as answered and start a new thread when you have a new question!
Csla has the CslaDataPortalUrl that you may set in your app.config or in code as the
ApplicationContext.DataPortalUrlString
Look at the SimpleNTier og ProjectTracker samples.
<appSettings> <add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/> <add key="CslaDataPortalUrl" value="http://localhost:21647/WcfPortal.svc"/> </appSettings>
Using this approach CSLA will autoconfigure the WCF channel.
This is the actual code in Csla.ApplicationContext:
private static string _dataPortalUrl = null;
public static string DataPortalUrlString { get { if (_dataPortalUrl == null) { _dataPortalUrl = ConfigurationManager.AppSettings["CslaDataPortalUrl"]; } return _dataPortalUrl; } set { _dataPortalUrl = value; } }
If you have special requirements then create your own version of the client side proxy class.
Any WCF configuration that you can define in app.config can also be done in code so you should
be able to have a "no-config" configuration in your application.
Awesome, thanks very much!!
Copyright (c) Marimer LLC