Basically, I created my WSDL and added a SimpleType with enum values: A, B, C. When I build my service with this wsdl I want the enum to be constructed with the FlagsAttribute
, but how do I specify that in my wsdl?
I'm using svcutil.exe to generate my C# code.
Update: I am building my server-side code using svcutil.exe. I do so by calling: svcutil.exe "Foo.wsdl" "globa开发者_如何学编程l.xsd"
. But, I'm unsure how to properly markup my wsdl/xsd tags so that the generated code comes out like so:
[Flags] //<-- How do you get this to become autogenerated?
public enum SomeEnum
{
A,
B,
C
}
Enumeration Types in Data Contracts explains this pretty nicely. From their example:
[DataContract][Flags]
public enum CarFeatures
{
None = 0,
[EnumMember]
AirConditioner = 1,
[EnumMember]
AutomaticTransmission = 2,
[EnumMember]
PowerDoors = 4,
AlloyWheels = 8,
DeluxePackage = AirConditioner | AutomaticTransmission | PowerDoors | AlloyWheels,
[EnumMember]
CDPlayer = 16,
[EnumMember]
TapePlayer = 32,
MusicPackage = CDPlayer | TapePlayer,
[EnumMember]
Everything = DeluxePackage | MusicPackage
}
Unless I'm missing the point here.
精彩评论