2
0

ServiceStackHost.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) Service Stack LLC. All Rights Reserved.
  2. // License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Threading.Tasks;
  7. using MediaBrowser.Model.Services;
  8. namespace ServiceStack
  9. {
  10. public abstract class ServiceStackHost : IDisposable
  11. {
  12. public static ServiceStackHost Instance { get; protected set; }
  13. protected ServiceStackHost()
  14. {
  15. GlobalResponseFilters = new List<Action<IRequest, IResponse, object>>();
  16. }
  17. public abstract object CreateInstance(Type type);
  18. public List<Action<IRequest, IResponse, object>> GlobalResponseFilters { get; set; }
  19. public abstract RouteAttribute[] GetRouteAttributes(Type requestType);
  20. public abstract Func<string, object> GetParseFn(Type propertyType);
  21. public abstract void SerializeToJson(object o, Stream stream);
  22. public abstract void SerializeToXml(object o, Stream stream);
  23. public abstract object DeserializeXml(Type type, Stream stream);
  24. public abstract object DeserializeJson(Type type, Stream stream);
  25. public virtual void Dispose()
  26. {
  27. //JsConfig.Reset(); //Clears Runtime Attributes
  28. Instance = null;
  29. }
  30. }
  31. }