Skip to content

Instantly share code, notes, and snippets.

View steff-mueller's full-sized avatar

Steffen Müller steff-mueller

View GitHub Profile
@steff-mueller
steff-mueller / ExampleRequest.cs
Created December 21, 2011 17:29
ServiceStack - Permission based authorization
//Example usage of these attributes:
[Authenticate]
[RequiredPermission("CanInspectTweets")]
[RequiredPermissionOnPost("CanAddTweets")]
[RequiredPermissionOnPut("CanAddTweets")]
[RequiredPermissionOnDelete("CanRemoveTweets")]
[RestService("/tweets",)]
public class Tweet { ... }
@steff-mueller
steff-mueller / Tutorial.markdown
Created December 23, 2011 14:06
Servicestack - Validation of request dtos

This feature is now included in the latest release of ServiceStack and the up-to-date documentation can be found here: https://github.com/ServiceStack/ServiceStack/wiki/Validation

FluentValidation for request dtos

First in the app host the validation mechanism must be initialized:

ValidationHandler.Init(this);

This request dto should be validated:

@steff-mueller
steff-mueller / Tutorial.markdown
Created December 26, 2011 11:24
Authentication and authorization in ServiceStack
@steff-mueller
steff-mueller / Example.cs
Created January 2, 2012 13:52
ServiceStack improvement
[RestService("/users", Verbs = "POST, GET")]
public class User
{
...
}
public class UserResponse
{
...
}
public class TweetsService : RestServiceBase<Tweets>
{
public ICacheClient Cache { get; set; }
public object OnGet(Tweets request)
{
var tweets = this.Cache.Get<List<Tweets>>("yourkey");
if(tweets == null)
{
tweets = LoadTweetsFromExternalService();
@steff-mueller
steff-mueller / Async_with_sleep.cs
Created May 16, 2012 16:52 — forked from ahall/gist:2710678
Async vs Sync for servicestack
// Async with 200 ms timeout
ahall@jetsam:~$ ab -c 5 -n 2000 "http://127.0.0.1:53211/async?format=json"
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 200 requests
Completed 400 requests
Completed 600 requests
@steff-mueller
steff-mueller / draft-notes.md
Created May 20, 2012 08:26 — forked from mythz/draft-notes.md
draft-notes.md

v3.78 Release Notes

Although it's been a long time between formal releases - v3.78 marks our been our biggest release ever! Mostly of a result of being too busy to prepare the release notes for all the effort that have gone into the framework (and supporting libraries) in the last 6 months :)

Today we hope to rectify this neglect with a special thanks to all the contributors that helped make this release possible. We would like to pay a special thanks to Steffen Müller @arxisos whose code and documentation contributions and support in the forums and real-time help over these last 6 months have been invaluable.

A lot of features being announced are already well known to our active user-base as they've shipped in our production release builds for months. Hopefully these notes will highlight other useful but less known features.

Awesome Feedback

@steff-mueller
steff-mueller / gist:2911124
Created June 11, 2012 16:35
ServiceStack | Async refactor?
public IAsyncService<TReq>
{
	Task<object> ExecuteAsync<TReq>(TReq req);
}
public class ServiceBase<TReq> : IAsyncService<TReq>
{
@steff-mueller
steff-mueller / gist:3177873
Created July 25, 2012 18:54
ServiceStack v4.00

Multiple reqeust DTOs per service

Default routes are normal REST routes now.

Default routes have changed to:

/[json/xml/jsv/csv/form]/[requestreply/oneway]/[operation name]

Async

The REST routes (AsyncRestHandler) and the SOAP handler (AsyncSoapHandler) are using IHttpAsyncHandler to process requests.

@steff-mueller
steff-mueller / RestServiceExtensions.cs
Created August 26, 2012 21:59 — forked from vansha/RestServiceExtensions.cs
ServiceStack RestService extension allowing to call REST services in a generic way.
namespace ServiceStack.Service
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using ServiceStack.Service;
using ServiceStack.ServiceClient.Web;
using ServiceStack.ServiceHost;