Click here to Skip to main content
15,910,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody,

I made a DLL (class library) in visual studio 2008 (.net 3.5), and this DLL have some dependencies with the app.config. Inside the app.config, i have some configurations about the consume with a specific soap web service.
Well, here´s the problem, i have to take this DLL and use in another code, but i don´t know how do that, because my DLL have these dependencies whith this app.config.
I know how to use ConfigurationSettings.AppSettings to retrive the config parameters, but, im don´t think if this gonna be the right idea.
Anybody here know something about the DLL´s distribuition?

(ps: if my inglish is not very good im sorry, inglish is not my first language).

Att,

Alex Duzi.
Posted
Comments
Sergey Alexandrovich Kryukov 26-Apr-13 15:59pm    
It's the best to centralize the settings in the application, even though the code could be in different DLL libraries. If you use the same DLL for different applications, what are you going to do?
Besides, you are not bound with app.config. You can use your own XML persistence for input parameters.
—SA
AlexDuzi 26-Apr-13 16:22pm    
Hi Sergey Kryukov,

Thanks for the advise, but if i made my own XML with some config sections, as will be my soap wsdl reference?

Att,

Alex Duzi.
Sergey Alexandrovich Kryukov 26-Apr-13 16:32pm    
Why do you want to couple it with SOAP. And if even you need it (I really doubt that), you can use soup serializer...
—SA
AlexDuzi 26-Apr-13 17:00pm    
Hi Sergey,

Here in Brazil we have many soap web services in all states, each state have your own soap web service for send invoices, and this web service have your own methods to consume, its very bored to work with that, so when i add a wsdl reference make the thinks very much easier to work. I don´t know anybody in Brazil who used the soap serialization for that specific web service, i can try serialize this soap but i don´t know how looks like the response for that =(, i will try create a separated XML first.
Thank´s again for the advise.

Att,

Alex Duzi.
Sergey Alexandrovich Kryukov 26-Apr-13 17:25pm    
These arguments say me nothing about the persistence of configuration. I usually use Data Contract, please see.
—SA

Hi,
I've the same problem... similar!
I'm working for developing a dll class library COM Interop enabled to export as TLB file so I can use these features on a VBA Project reside on a MS ACCESS database.

One of things that I'm trying to do is to implement a user management system for the MS Access DB that using Membership provider for authentication, roles and may be also profile. I've read many paper on Client Application Service for using ASP.NET Membeship features directly on a WinForms project, by interacting with an "LAN-Based web-service" that uses SQL Server for Membership data store. All working fine while I'm try to operate with this service by a WinForm VS Project, 'cause it correctly load own app.settings file that contains info about where to find the Provider. But, the problem is: when I use these settings from the Class Library referenced onto MS ACCESS, the hoster application not have all the provider configuration, so if i cicle inside providers collection I can only find the default "SqlMembershipProvider" and not the "ClientApplicationProvider" configured from myself from the Project > Properties > Services of the DLL VS Project.

At this moment, so, I'm unabled to interact with Client Service Provider when I call my class functions of DLLibraries from MS Access. What I can do? I'm wondering about the possibility of run-time instantiate membership provider direct into my DLL, without reading any config file, but I don't know how to implement this particular configuration. Do you have some idea, or other workflow to be adopted for that issue?

Thanks to all in advance, good job!

Daniel Grandis
 
Share this answer
 
When you use ConfigurationSettings.AppSettings in a class library dll, the app.config that is actually read is the host of the dll. For example, if the dll were used in a website it would look to web.config. If it were used in a Windows Forms app then it would be app.config.

So, you can either use your own logic to read in an xml file of settings, read the settings from the db, or copy your settings into the hosters .config file.
 
Share this answer
 
Comments
AlexDuzi 26-Apr-13 17:11pm    
Hi ryanb31,

Thank´s for the advise, i will test some ideas here.

Att,

Alex Duzi.
Thanks for the advise guys, but i´ve made a static method that return the Bind for the webservice at runtime. So i don´t need the app.config anymore!

thanks

Duzi.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900