When I set some values on an object in my client controller and then step through the debugger as far as I can, I end up here:
public class WCFServiceAuthenticateClientBehavior : IEndpointBehavior, IClientMessageInspector
{
public WCFServiceAuthenticateClientBehavior(
HttpRequestBase request,
string authTokenAlias = "authToken",
string ajaxTokenAlias = "ajaxToken")
{
}
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(this);
}
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
request.Headers.Add(...etc); // last call before service is here
return null;
}
}
If I open the Immediate Window, I can print request.toString()
and see that the XML has the values that I expect. For example this value:
<d4p1:AccrualRevenueRecognition>AccrualEvenly</d4p1:AccrualRevenueRecognition>
However when the breakpoint at my Service method is hit, inspecting that object shows that AccrualRevenueRecognition
does not reflect this value from the XML.
My question is: Is there a place in my service where I can debug earlier, before the method called by my client, to see if the value is lost there?
FWIW, this is only happening with enums and AccrualRevenueRecognition
is an enum that looks like this:
[DataMember]
[Column("accrual_revenue_recognition")]
public byte AccrualRevenueRecognitionId
{
get
{
return (byte)this.AccrualRevenueRecognition;
}
set
{
AccrualRevenueRecognition = (AccrualRevenueRecognitionChoices) value;
}
}
[DataMember]
[EnumDataType(typeof(AccrualRevenueRecognitionChoices))]
public AccrualRevenueRecognitionChoices AccrualRevenueRecognition { get; set; }
[DataContract]
[Flags]
public enum AccrualRevenueRecognitionChoices
{
[EnumMember]
NotSet = 0,
[EnumMember]
AccrualEvenly = 1,
[EnumMember]
AccrualAtInvoice = 2,
[EnumMember]
AccrualAtPayment = 3
}
The class containing this enum is using [DataContract, Serializable]
and the method called from the client is using [VerificationSameOrigin]
.