[Edit]: I added the TokenType enum, what caused the whole issue...
I have an issue using WCF and unfortunately I didn't find any useful help. I am creating a WCF based application. When the server responds to the client's request, I want the send back the following class:
[DataContract]
public enum TokenType
{
User,
Device
}
[DataContract]
public class AuthenticationResponse
{
[DataMember]
public LogonStatus Status { get; set; }
[DataMember]
public AccessToken Token { get; set; }
}
[DataContract]
public struct AccessToken
{
[DataMember]
public string TokenID
{
get;
set;
}
[DataMember]
public TokenType Type
{
get;
set;
}
[DataMember]
public string Uid
{
get;
set;
}
[DataMember]
public string Name
{
get;
set;
}
[DataMember]
public DateTime ExpirationTime
{
get;
set;
}
[DataMember]
public DateTime GenerationTime
{
get;
set;
}
[DataMember]
public bool IsExpired
{
get
{
return DateTime.Now > this.ExpirationTime;
}
}
}
When I send the AuthenticationResponse back to the client, it always fails. My qusetion: Is there any chance to use class/struct objects within DataContract object or do I have to replace the AccessToken object with basic types (e.g. string) in the AuthenticationResponse object?
Thanks all your helps! Best regards
Gabor
Ahh... Sorry for that. I was really stupid... I forgot to paste the TokenType enum in my original question what is part of AuthenticationResponse class, and this was the problem... I forget the set the [EnumMember] attributes...
After I added, everything worked well.
Sorry for this stupid and really beginner problem...
Thanks all your helps!!!