i'm developing windows phone 7 app uses wcf service.
i need use on both projects following code:
public enum gametype { monoplayer = 1, multiplayer = 2 }
i'm sure must not define enum on both projects, figure out need find solution.
i think need use third project have put enum.
do have better approach?
wcf uses contracts, enum must decorated contract.
for instance, can have:
[datacontract] public enum gametype { [enummember] monoplayer = 0, [enummember] multiplayer = 1 }
you put enum file in separate project, can shared client , wcf service.
then, in service contract (i.e., interface of wcf service), must declare enum "known type", so:
[servicecontract] [serviceknowntype(typeof(gametype))] public interface imyservice {...}
that should it!
Comments
Post a Comment