O'Reilly logo

Mastering ServiceStack by Andreas Niedermair

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Registering new services and endpoints

Apart from the registration of filters, you can also add services to any application host by simply calling RegisterService on the provided host object.

To show you a real life scenario, we will implement a plugin that restricts the throughput of your services. This plugin will also register a service that we can use to inspect the current throughput of the service.

We will start off with the creation of an attribute to define the maximum throughput of an operation.

using System; using ServiceStack; public class ThrottleRestrictionAttribute : Attribute { public const string MinuteAbbreviation = "m"; public const string HourAbbreviation = "h"; public const string DayAbbreviation = "d"; public int PerMinute { ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required