From 406e6cb8132c1b8ade2872d44d7183267dd51ca8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 11 Nov 2016 14:55:12 -0500 Subject: update portable projects --- ServiceStack/FilterAttributeCache.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ServiceStack/FilterAttributeCache.cs (limited to 'ServiceStack/FilterAttributeCache.cs') diff --git a/ServiceStack/FilterAttributeCache.cs b/ServiceStack/FilterAttributeCache.cs new file mode 100644 index 000000000..378433add --- /dev/null +++ b/ServiceStack/FilterAttributeCache.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading; +using ServiceStack; + +namespace ServiceStack.Support.WebHost +{ + public static class FilterAttributeCache + { + public static MediaBrowser.Model.Services.IHasRequestFilter[] GetRequestFilterAttributes(Type requestDtoType) + { + var attributes = requestDtoType.AllAttributes().OfType().ToList(); + + var serviceType = ServiceStackHost.Instance.Metadata.GetServiceTypeByRequest(requestDtoType); + if (serviceType != null) + { + attributes.AddRange(serviceType.AllAttributes().OfType()); + } + + attributes.Sort((x,y) => x.Priority - y.Priority); + + return attributes.ToArray(); + } + } +} -- cgit v1.2.3