开发者

why Microsoft's WCF example so complicated?

开发者 https://www.devze.com 2023-04-03 14:37 出处:网络
I\'m comparing two examples of WCF. Microsoft\'s examples http://msdn.microsoft.com/en-us/library/ms734712.aspx uses app.config file, uses generator svcutil.exe to generate client and in general produ

I'm comparing two examples of WCF. Microsoft's examples http://msdn.microsoft.com/en-us/library/ms734712.aspx uses app.config file, uses generator svcutil.exe to generate client and in general produces much more code.

Another example http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication much simpler - only two C# files, no auto generated code, no app.config.

Both examples seems to do the same thing.

The question is:

  1. should I use app.config in my program or this file is redundant?
  2. should I tr开发者_JS百科y to use Microsoft's "auto-generate client" program or it's better to avoid it?
  3. which of these two examples I should follow when implementing own WCF program?


WCF allows you to configure the bindings either programmatically or via configuration. Configuration is sometimes convenient if you (or someone else like a test team/customer) trying out different binding options. For example, the QA team could be doing perf testing and trying the different ways to serialize data over the wire. Or, a customer may have different firewall constraints etc...

In both cases, being able to change binding options on the fly without recompiling is useful.

If you know exactly how you want to send the data, then programmatically configuring it and compiling it into your code may be best. It's certainly easier to configure and less error prone.

0

精彩评论

暂无评论...
验证码 换一张
取 消