Tuesday, December 17, 2013

naming convention bridge between routes and services in ServiceStack

Building on this blog posting on ServiceStack, it would seem that the attributes magic allows a route class like so...

[Route("/widgets", "POST")]
[Authenticate]
public class WidgetCreate : Widget
{
   public string Foo { get; set; }
   public int Bar { get; set; }
   public DateTime Baz { get; set; }
   public bool Qux { get; set; }
}

 
 

...to find a dance partner such as this:

public class WidgetCreateService
{
   public MyDataTransferObjectToHandBackAsJson Post(Widget widget)
   {
      
whatever...

 
 

The name of the service class is the name of its route with "Service" appended to its end.

No comments:

Post a Comment