Delegates for request handlers?

Topics: Web Api
Oct 30, 2010 at 7:12 PM

Will it be possible to define request handlers as delegates of type Func<HttpRequestMessage, HttpResponseMessage>? So far all the examples show classes with methods. I would like to be able to use lambdas or even static classes with delegates, if possible. (This is coming from an F# perspective.)

Coordinator
Oct 30, 2010 at 9:40 PM

Hi Ryan

Currently no, but that is something we could explore. My first though is maybe this would fit better in the planned resource model as we'll have more flexibility with how we handle dispatch.

However, in terms of the request, would you want to have a single Func for a request which handles all HTTP methods? Or would you want to have separate funcs for Get, Post, Put, etc...?

 

Nov 4, 2010 at 7:43 AM
I just care about a single delegate that can act as a handler for a route. I can manage additional things from there. I imagine I'll actually have a delegate for an entire app and do my routing internally, but that's only a possibility. So overloads for accepting delegates per method is not necessary.

Thanks!
Ryan

On Sat, Oct 30, 2010 at 1:40 PM, gblock <notifications@codeplex.com> wrote:

From: gblock

Hi Ryan

Currently no, but that is something we could explore. My first though is maybe this would fit better in the planned resource model as we'll have more flexibility with how we handle dispatch.

However, in terms of the request, would you want to have a single Func for a request which handles all HTTP methods? Or would you want to have separate funcs for Get, Post, Put, etc...?

Read the full discussion online.

To add a post to this discussion, reply to this email (wcf@discussions.codeplex.com)

To start a new discussion for this project, email wcf@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Coordinator
Nov 4, 2010 at 8:53 PM

Thanks Ryan.

I suspect once we have the new config model online you will be able to handle this easily. Free free to file a work item.