Set DataPortalProxy from dll

Set DataPortalProxy from dll

Old forum URL: forums.lhotka.net/forums/t/4379.aspx


madsgonzo@hotmail.com posted on Wednesday, February 20, 2008

Hi

I´m creating a shared addin for Office word, Outlook and Excel. When the addin is build a .dll and a .dll.config is created, but the ConfugurationManager used in CSLA can not read the .dll.config file - so it always returns a LocalDataPortalProxy, and i use a remote one.

This seems to be by .NET design. But I need a Shared Addin, to many problems using VSTO.
In VSTO I could use a .dll with no problems.

Is there any way I can force a RemoteProxy without changing CSLA? Or does any one have a better idea?

Have a nice day.
Mads

ajj3085 replied on Wednesday, February 20, 2008

I have an outlook add-in and it uses the assembly.dll.config file.  Are you sure you're deploying it correctly?  My add-in wouldn't work because my db connection is in that file.

madsgonzo@hotmail.com replied on Wednesday, February 20, 2008

This is the content of the office.dll.config file.

<?xml version="1.0" encoding="utf-8"?>
<
configuration>
<
appSettings>
<
add key="CslaDataPortalProxy" value="Csla.DataPortalClient.RemotingProxy, Csla" />
<
add key="CslaDataPortalUrl" value="http://win2003svr/Host/RemotingPortal.rem" />
</
appSettings>
</
configuration>

 

madsgonzo@hotmail.com replied on Thursday, February 21, 2008

If I create a C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE.config file CSLA reads the information just fine. But I can´t distribute config files to the end-users Office folder.

Is there some way to force CSLA to read from a given config file?

Something like:

Dim currentDomain As AppDomain = AppDomain.CurrentDomain
Dim strPath As String = IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly.Location) & "\app.exe.config"
currentDomain.SetupInformation.ConfigurationFile = strPath

Mads

ajj3085 replied on Thursday, February 21, 2008

Csla doesn't provide for that, so you'd have to modify Csla to do it yourself.  I'm suprised, because my outlook plugin doesn't require me to do anything special.

Copyright (c) Marimer LLC