Revision: 39877
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 22, 2011 02:50 by RichardCustance
Initial Code
public class CreateExtension : IEndpointBehaviorExtender
{
#region IEndpointBehaviorExtender Members
public string Action
{
get { return "Expense/Create"; }
}
public void BeforeSendRequest(string action, ref Message request, IDictionary<string, object> formData)
{
// create a strongly type version of the message
ExpenseCreateRequestMessage req = MessageConverter<ExpenseCreateRequestMessage>.GetObjectFromMessage(action, request);
// the data contract already has additonal collections (dictionaries) so that
// additional data can be stored along with the default contract.
// Try to make 'key' as unique as possible so that only you could identify it. Perhaps add your name / intials or BP Channel Name
if (!req.Expense.FieldExtensions.ContainsKey("RBC_DateExpenseCreated"))
req.Expense.FieldExtensions.Add("RBC_DateExpenseCreated", DateTime.Now.ToLongDateString());
// replace the message request with new one
request = MessageConverter<ExpenseCreateRequestMessage>.SetMessageFromObject(action, req, request.Headers.MessageVersion);
}
public void AfterReceiveReply(string action, Message reply)
{
// convert the message to its strong type (as described in contract library)
ExpenseCreateResponseMessage response = MessageConverter<ExpenseCreateResponseMessage>.GetObjectFromMessage(action, reply);
// do stuff with respones...
}
#endregion
}
Initial URL
Initial Description
Initial Title
Web Extensibility Download Part 3 - Extending Client-side code behavior
Initial Tags
Initial Language
C#