user31673
user31673

Reputation: 13685

.NET Service Reference without using config file

I have been using Web References in the past but started playing around with Service References for web services for calls made to third party web services. One major difference I found is that Service References place information in the config file. I am creating a DLL file that will make all the calls to the Service Reference's web service. When I reference that DLL an another project, I don't want to have to add the config information into the new project. In using Web References, there was never a need to use anything other than the DLL that contains the Web Reference. No config data was necessary. Is there any way to get this same behavior using Service References or are they dependent on config files?

Upvotes: 0

Views: 367

Answers (1)

Morv
Morv

Reputation: 390

Yes, there is.

.config files are a fancy and flexible way to change behaviour without recompilation.

Everything that you can set in .config can be set programatically so you either:

  • hard code the definitions in the source code
  • fetch the defitions from a database or any other trusted source

Allowing the project that encapsules the service reference to have its settings web reference settings defined by other projects is needed.

Upvotes: 1

Related Questions