Currently, I'm having problem to access Enum in my application, here is the service code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Web.Security;
namespace Exousia.Services.Helpers
{
[ServiceContract]
public interface IFeedbackMessageService
{
[OperationContract]
String GetMessage(MembershipCreateStatus membershipCreateStatus);
}
[DataContract]
public enum LogOnStatus
{
[EnumMember]
Success,
[EnumMember]
InvalidUserNameOrPassword
}
[DataContract]
public enum LogOffStatus
{
[EnumMember]
Success
}
[DataContract]
public enum ContactFormStatus
{
[EnumMember]
Success
}
}
In my application that already have this Service Reference, I can't access the enum data type, only GetMessage that is visible? How to fix this problem?
I think even you declaredthe enum in you class file, you are not using it in you service methods. So it is not incorporated in the proxy.
Try to include in a operation and see.
[OperationContract]
LogOnStatus GetLogOnStatus();
Thanks,
Bimal
But when I'm using this one as data contract, it can appear in the client:
[DataContract]
public class DateOfBirth
{
String user;
String family;
String area;
DateTime? date;
[DataMember]
public String User
{
get { return user; }
set { user = value; }
}
[DataMember]
public String Family
{
get { return family; }
set { family = value; }
}
[DataMember]
public String Area
{
get { return area; }
set { area = value; }
}
[DataMember]
public DateTime? Date
{
get { return date; }
set { date = value; }
}
}
I'm using this just for a type not for Operation or getting something. So how to make it working like example above?
jazzyhacker
Member
11 Points
103 Posts
Can't Access Enum (Data Contract) in Client Application
Nov 15, 2012 02:54 PM|LINK
Currently, I'm having problem to access Enum in my application, here is the service code:
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; using System.Web.Security; namespace Exousia.Services.Helpers { [ServiceContract] public interface IFeedbackMessageService { [OperationContract] String GetMessage(MembershipCreateStatus membershipCreateStatus); } [DataContract] public enum LogOnStatus { [EnumMember] Success, [EnumMember] InvalidUserNameOrPassword } [DataContract] public enum LogOffStatus { [EnumMember] Success } [DataContract] public enum ContactFormStatus { [EnumMember] Success } }In my application that already have this Service Reference, I can't access the enum data type, only GetMessage that is visible? How to fix this problem?
Thanks in advance.
Bimalvv
Contributor
2356 Points
478 Posts
Re: Can't Access Enum (Data Contract) in Client Application
Nov 15, 2012 03:20 PM|LINK
Hi,
I think even you declaredthe enum in you class file, you are not using it in you service methods. So it is not incorporated in the proxy.
Try to include in a operation and see.
Thanks,
Bimal
Bimal
jazzyhacker
Member
11 Points
103 Posts
Re: Can't Access Enum (Data Contract) in Client Application
Nov 15, 2012 03:23 PM|LINK
But when I'm using this one as data contract, it can appear in the client:
[DataContract] public class DateOfBirth { String user; String family; String area; DateTime? date; [DataMember] public String User { get { return user; } set { user = value; } } [DataMember] public String Family { get { return family; } set { family = value; } } [DataMember] public String Area { get { return area; } set { area = value; } } [DataMember] public DateTime? Date { get { return date; } set { date = value; } } }I'm using this just for a type not for Operation or getting something. So how to make it working like example above?
Thanks in advance.
Bimalvv
Contributor
2356 Points
478 Posts
Re: Can't Access Enum (Data Contract) in Client Application
Nov 15, 2012 04:31 PM|LINK
Hi,
No, I am not getting this class in proxy. Can you share the service contract also?
http://msdn.microsoft.com/en-us/library/vstudio/ms733881%28v=vs.100%29.aspx
Thanks,
Bimal
Bimal
jazzyhacker
Member
11 Points
103 Posts
Re: Can't Access Enum (Data Contract) in Client Application
Nov 15, 2012 11:02 PM|LINK
I think you are right, because I use DateOfBirth class as a parameter, so it is included in the proxy classes. Thanks anyway.