If app.config for a DLL should be in the “main config”… what do we do with WCF References in DLLs?

后端 未结 3 1927
暖寄归人
暖寄归人 2020-12-29 09:59

Ok, this is rather simple, but from what I\'ve seen… you can only use some sort of Windows Workflow to include another config into another (which I refuse to do).

He

相关标签:
3条回答
  • 2020-12-29 10:22

    Yes. Copy and paste is the answer. It's not a great answer, but it's the answer, and it has been since day 1 in .NET 1.0 with AppSettings.

    0 讨论(0)
  • 2020-12-29 10:22

    You can have a library project include custom config files and those files can be copied to the executable location of another application (it's a little sticky, but not too big a deal). You just have to use OpenMappedExeConfiguration to get to any information in those files. You'd then have to do some custom coding when you instantiate your WCF proxies (instantiate a Binding and pass that to the proxy). I'm late to the party here, but I can provide more details if you're interested.

    0 讨论(0)
  • 2020-12-29 10:26

    No you're right.

    But surely your WCF services are not in the business layer project, but instead in a separate project which acts as a facade into the business layer. Your business layer is then just another assembly as it should be and doesn't care how it's accessed, the WCF project does that for it.

    Or of course you write custom service hosts and put the minimal amount of information in the config file (host name, certificate thumbprint) and do the rest in code.

    0 讨论(0)
提交回复
热议问题