0

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?

user31673
  • 13,245
  • 12
  • 58
  • 96
  • isn't [this post](http://stackoverflow.com/questions/54579/wcf-configuration-without-a-config-file) answering your question? – Grzegorz W Jan 31 '13 at 23:26

1 Answers1

1

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.

Morv
  • 355
  • 2
  • 9
  • Do you have any examples or documents about how the config settings relate to setting them programmically? – user31673 Feb 01 '13 at 00:12
  • Check [this](http://msdn.microsoft.com/en-us/magazine/cc163412.aspx) out. I believe it covers your needs in Figure 1. – Morv Feb 01 '13 at 00:41
  • I believe it covers your needs and provides insight over a lot of definitions. The article shows how different WCF object properties are set using either .config files or programatically. (Sorry about extra comment. I didn't edit the previous comment fast enough) – Morv Feb 01 '13 at 00:49