EL For ActiveX

Topics: Building and extending application blocks
Jul 25, 2011 at 1:37 AM

    I have written a library configured with app.config that include the configuration for el. But When I registered the dll, I found that the configuration for el is not effective and the configuration for appsettigs is effective. Did anyone meet the trouble, How to handle the EL cofiguration for ActiveX?

Jul 25, 2011 at 2:07 AM

Hi,

Can you be more elaborate on your issue? What do you mean when you said that "configuration for el is not effective and the configuration for appsettigs is effective". Anyway, note that the configuration should be located on the exe application and not on the referenced library.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Jul 25, 2011 at 3:38 AM

1、 I have a class project named "Library", when I compile it, there existLibrary.dll and Library.dll.config in bin/debug folder.

 some code snippets "Library.dll.config" like this:

</configuration>
     <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
   ...// other unity configuration
    <userSettings>
    <Library.Properties.Settings>
      <setting name="IsMockSerialPort" serializeAs="String">
        <value>False</value>
      </setting>
    </Library.Properties.Settings>
  </userSettings>
  ... // other appconfig
</configuration>

2、I Register the Library.dll to COM Control, using the command "regasm /codebase Library.dll".

3、Now, I can access the COM control in html like this, "<OBJECT id="MainModel" name="MainModel" classid="clsid:DA07C0A8-EFD8-41D6-B04C-E28168058C69" VIEWASTEXT></OBJECT>"

4、I find that the logger configuration in the config file is not effective, and the usersettings is effective. In the other wold, I call some method in the COM control, the contant in usersettings can be changed, but can't instantiate a "Logger" Object.

How to process the problem?

Jul 25, 2011 at 5:44 AM

To be honest, I haven't done EL with COM but the most obvious reason to me why it doesn't work is that you configured your EL settings inside a class library. You should define your EL settings on the executable application that is referencing the COM. Hope this helps.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

 

 

Jul 25, 2011 at 6:30 PM

It is possible to configure the logging application block directly in code using the fluent interface. 

http://msdn.microsoft.com/en-us/library/ff664363(v=pandp.50).aspx

That way you can place the configuration code directly in your library.

 Hope it helps.

Jul 26, 2011 at 6:40 AM

@AvanadeSupport:Thanks for you reply.  You are right, It works that I define my EL settings on the executable application. But in fact, my project is web site, is there solution for the situation?

@risc024:I agree with  your idea, and I'm planning to change to a new version that using fluent interface. But as a discuss, I want to know how to use a confuguration file in this situation.

Jul 26, 2011 at 12:40 PM

Yes, you can define your settings in web configuration file (web.config). Sorry for mentioning the term "executable" the most appropriate term . What I mean is the configuration should be defined on the application (console, windows, web, etc). Hope this helps :)

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us