Do you use enum types in your WCF web services?

前端 未结 9 2067
臣服心动
臣服心动 2020-11-27 06:06

I\'ve heard some people saying that enums are evil and shouldn\'t be used in web services because of the mismatches that could occur between the server and the client if som

9条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 06:16

    I have used enums in WCF, also in interoperability scenarios. If you control both sides of the service, it is easier to work with. If you only control one side of the service, you need to look out for the issues that you mentioned.

    Enums are so much better that string variables, or what else you might choose to use. Using strings instead of enums is an anti pattern called "loosey Goosey" in SOA.

提交回复
热议问题