I have a situation like this, where i have
- WCF Service (VS2008) Hosted somewhere
- Main Solution (VS2005) which has a Consumer Project of type 'class Library' with the Service reference to this WCF Service
In the data Contract i have a Data Member as follows...
[DataContract] public class Cmd { [DataMember] public string CommandText; [DataMember] public CommandType CommandType; }
The proxy service.cs is generated in my consumer project's service reference Folder (might be because i am using vs 2005), which contains all the declarations of the service where enum CommandType has got a new definition
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.30")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/System.Data")]
public enum CommandType
{
Text,
StoredProcedure,
TableDirect,
}
instead of this original enum from System.Data
public enum CommandType
{
Text = 1,
StoredProcedure = 4,
TableDirect = 512,
}
which causes incorrect assignment of CommandType values from client to server,
- what should i do to overcome this.
- can we override this CommandType enum on the WCF service to get same enum definition throughout.
Sorry for such a long problem statement...