CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Composite operation behaviors

325 Views
Copy Code Show/Hide Line Numbers
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
// NOTE: If the service is renamed, remember to update the global.asax.cs file
public class MessageService
{
    [WebGet(UriTemplate = "/Method1?a={var1}&b={var2}")]
    [CompositeOperationBehavior("MessageService")]
    public Message GetMessage(string var1, string var2)
    {
        return WebOperationContext.Current.CreateTextResponse(var1 + var2);
    }
}
 
public class MessageServiceBehaviors
{
    [ExportOperationBehavior(Group = "MessageService")]
    public IOperationBehavior Required
    {
        get { return new RequiredParameterBehaviorAttribute("var2"); }
    }
}
by Glenn Block
  July 02, 2010 @ 9:51pm

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate