Skip to main content

ServiceExtensions

Assembly: ServiceStack.dll​
View Source​
Declaration
public static class ServiceExtensions

Fields​

Log​

View Source​
Declaration
public static ILog Log

Methods​

Redirect(IServiceBase, String)​

View Source​
Declaration
public static IHttpResult Redirect(this IServiceBase service, string redirect)
Returns​

ServiceStack.Web.IHttpResult

Parameters​
TypeName
ServiceStack.IServiceBaseservice
System.Stringredirect

Redirect(IServiceBase, String, String)​

View Source​
Declaration
public static IHttpResult Redirect(this IServiceBase service, string redirect, string message)
Returns​

ServiceStack.Web.IHttpResult

Parameters​
TypeName
ServiceStack.IServiceBaseservice
System.Stringredirect
System.Stringmessage

LocalRedirect(IServiceBase, String)​

View Source​
Declaration
public static IHttpResult LocalRedirect(this IServiceBase service, string redirect)
Returns​

ServiceStack.Web.IHttpResult

Parameters​
TypeName
ServiceStack.IServiceBaseservice
System.Stringredirect

LocalRedirect(IServiceBase, String, String)​

View Source​
Declaration
public static IHttpResult LocalRedirect(this IServiceBase service, string redirect, string message)
Returns​

ServiceStack.Web.IHttpResult

Parameters​
TypeName
ServiceStack.IServiceBaseservice
System.Stringredirect
System.Stringmessage

AuthenticationRequired(IServiceBase)​

View Source​
Declaration
public static IHttpResult AuthenticationRequired(this IServiceBase service)
Returns​

ServiceStack.Web.IHttpResult

Parameters​
TypeName
ServiceStack.IServiceBaseservice

GetSessionId(IServiceBase)​

View Source​
Declaration
public static string GetSessionId(this IServiceBase service)
Returns​

System.String

Parameters​
TypeName
ServiceStack.IServiceBaseservice

GetCacheClient(IRequest)​

View Source​
Declaration
public static ICacheClient GetCacheClient(this IRequest request)
Returns​

ServiceStack.Caching.ICacheClient

Parameters​
TypeName
ServiceStack.Web.IRequestrequest

GetCacheClientAsync(IRequest)​

View Source​
Declaration
public static ICacheClientAsync GetCacheClientAsync(this IRequest request)
Returns​

ServiceStack.Caching.ICacheClientAsync

Parameters​
TypeName
ServiceStack.Web.IRequestrequest

GetMemoryCacheClient(IRequest)​

View Source​
Declaration
public static ICacheClient GetMemoryCacheClient(this IRequest request)
Returns​

ServiceStack.Caching.ICacheClient

Parameters​
TypeName
ServiceStack.Web.IRequestrequest

SaveSession(IServiceBase, IAuthSession, Nullable<TimeSpan>)​

View Source​
Declaration
[Obsolete("Use SaveSessionAsync")]
public static void SaveSession(this IServiceBase service, IAuthSession session, TimeSpan? expiresIn = null)
Parameters​
TypeName
ServiceStack.IServiceBaseservice
ServiceStack.Auth.IAuthSessionsession
System.Nullable<System.TimeSpan>expiresIn

SaveSessionAsync(IServiceBase, IAuthSession, Nullable<TimeSpan>, CancellationToken)​

View Source​
Declaration
public static async Task SaveSessionAsync(this IServiceBase service, IAuthSession session, TimeSpan? expiresIn = null, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.IServiceBaseservice
ServiceStack.Auth.IAuthSessionsession
System.Nullable<System.TimeSpan>expiresIn
System.Threading.CancellationTokentoken

RemoveSession(IServiceBase)​

View Source​
Declaration
public static void RemoveSession(this IServiceBase service)
Parameters​
TypeName
ServiceStack.IServiceBaseservice

RemoveSessionAsync(IServiceBase, CancellationToken)​

View Source​
Declaration
public static Task RemoveSessionAsync(this IServiceBase service, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.IServiceBaseservice
System.Threading.CancellationTokentoken

RemoveSession(Service)​

View Source​
Declaration
public static void RemoveSession(this Service service)
Parameters​
TypeName
ServiceStack.Serviceservice

RemoveSessionAsync(Service, CancellationToken)​

View Source​
Declaration
public static Task RemoveSessionAsync(this Service service, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Serviceservice
System.Threading.CancellationTokentoken

CacheSet<T>(ICacheClient, String, T, Nullable<TimeSpan>)​

View Source​
Declaration
public static void CacheSet<T>(this ICacheClient cache, string key, T value, TimeSpan? expiresIn)
Parameters​
TypeName
ServiceStack.Caching.ICacheClientcache
System.Stringkey
<T>value
System.Nullable<System.TimeSpan>expiresIn
Type Parameters​
  • T

CacheSetAsync<T>(ICacheClientAsync, String, T, Nullable<TimeSpan>, CancellationToken)​

View Source​
Declaration
public static async Task CacheSetAsync<T>(this ICacheClientAsync cache, string key, T value, TimeSpan? expiresIn, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Caching.ICacheClientAsynccache
System.Stringkey
<T>value
System.Nullable<System.TimeSpan>expiresIn
System.Threading.CancellationTokentoken
Type Parameters​
  • T

SaveSession(IRequest, IAuthSession, Nullable<TimeSpan>)​

View Source​
Declaration
[Obsolete("Use SaveSessionAsync")]
public static void SaveSession(this IRequest httpReq, IAuthSession session, TimeSpan? expiresIn = null)
Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Auth.IAuthSessionsession
System.Nullable<System.TimeSpan>expiresIn

SaveSessionAsync(IRequest, IAuthSession, Nullable<TimeSpan>, CancellationToken)​

View Source​
Declaration
public static Task SaveSessionAsync(this IRequest httpReq, IAuthSession session, TimeSpan? expiresIn = null, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Auth.IAuthSessionsession
System.Nullable<System.TimeSpan>expiresIn
System.Threading.CancellationTokentoken

RemoveSession(IRequest)​

View Source​
Declaration
public static void RemoveSession(this IRequest httpReq)
Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq

RemoveSessionAsync(IRequest, CancellationToken)​

View Source​
Declaration
public static Task RemoveSessionAsync(this IRequest httpReq, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
System.Threading.CancellationTokentoken

RemoveSession(IRequest, String)​

View Source​
Declaration
public static void RemoveSession(this IRequest httpReq, string sessionId)
Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
System.StringsessionId

RemoveSessionAsync(IRequest, String, CancellationToken)​

View Source​
Declaration
public static async Task RemoveSessionAsync(this IRequest httpReq, string sessionId, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
System.StringsessionId
System.Threading.CancellationTokentoken

GetSession(IServiceBase, Boolean)​

View Source​
Declaration
public static IAuthSession GetSession(this IServiceBase service, bool reload = false)
Returns​

ServiceStack.Auth.IAuthSession

Parameters​
TypeName
ServiceStack.IServiceBaseservice
System.Booleanreload

GetSessionAsync(IServiceBase, Boolean, CancellationToken)​

View Source​
Declaration
public static Task<IAuthSession> GetSessionAsync(this IServiceBase service, bool reload = false, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<ServiceStack.Auth.IAuthSession>

Parameters​
TypeName
ServiceStack.IServiceBaseservice
System.Booleanreload
System.Threading.CancellationTokentoken

SessionAs<TUserSession>(IRequest)​

View Source​
Declaration
public static TUserSession SessionAs<TUserSession>(this IRequest req)
Returns​

<TUserSession>

Parameters​
TypeName
ServiceStack.Web.IRequestreq
Type Parameters​
  • TUserSession

SessionAsAsync<TUserSession>(IRequest, CancellationToken)​

View Source​
Declaration
public static async Task<TUserSession> SessionAsAsync<TUserSession>(this IRequest req, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<<TUserSession>>

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Threading.CancellationTokentoken
Type Parameters​
  • TUserSession

IsAuthenticated(IRequest)​

View Source​
Declaration
[Obsolete("Use IsAuthenticatedAsync")]
public static bool IsAuthenticated(this IRequest req)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Web.IRequestreq

IsAuthenticatedAsync(IRequest)​

View Source​
Declaration
public static Task<bool> IsAuthenticatedAsync(this IRequest req)
Returns​

System.Threading.Tasks.Task<System.Boolean>

Parameters​
TypeName
ServiceStack.Web.IRequestreq

AssertAuthenticatedSession(IRequest, Boolean)​

View Source​
Declaration
public static IAuthSession AssertAuthenticatedSession(this IRequest req, bool reload = false)
Returns​

ServiceStack.Auth.IAuthSession

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Booleanreload

AssertAuthenticatedSessionAsync(IRequest, Boolean, CancellationToken)​

View Source​
Declaration
public static async Task<IAuthSession> AssertAuthenticatedSessionAsync(this IRequest req, bool reload = false, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<ServiceStack.Auth.IAuthSession>

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Booleanreload
System.Threading.CancellationTokentoken

GetSession(IRequest, Boolean)​

View Source​
Declaration
public static IAuthSession GetSession(this IRequest httpReq, bool reload = false)
Returns​

ServiceStack.Auth.IAuthSession

Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
System.Booleanreload

GetSessionAsync(IRequest, Boolean, CancellationToken)​

View Source​
Declaration
public static Task<IAuthSession> GetSessionAsync(this IRequest httpReq, bool reload = false, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<ServiceStack.Auth.IAuthSession>

Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
System.Booleanreload
System.Threading.CancellationTokentoken

GetSessionTimeToLive(ICacheClient, String)​

View Source​
Declaration
public static TimeSpan? GetSessionTimeToLive(this ICacheClient cache, string sessionId)
Returns​

System.Nullable<System.TimeSpan>

Parameters​
TypeName
ServiceStack.Caching.ICacheClientcache
System.StringsessionId

GetSessionTimeToLiveAsync(ICacheClientAsync, String, CancellationToken)​

View Source​
Declaration
public static async Task<TimeSpan?> GetSessionTimeToLiveAsync(this ICacheClientAsync cache, string sessionId, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Nullable<System.TimeSpan>>

Parameters​
TypeName
ServiceStack.Caching.ICacheClientAsynccache
System.StringsessionId
System.Threading.CancellationTokentoken

GetSessionTimeToLive(IRequest)​

View Source​
Declaration
public static TimeSpan? GetSessionTimeToLive(this IRequest httpReq)
Returns​

System.Nullable<System.TimeSpan>

Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq

GetSessionTimeToLiveAsync(IRequest, CancellationToken)​

View Source​
Declaration
public static Task<TimeSpan?> GetSessionTimeToLiveAsync(this IRequest httpReq, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Nullable<System.TimeSpan>>

Parameters​
TypeName
ServiceStack.Web.IRequesthttpReq
System.Threading.CancellationTokentoken

RunAction<TService, TRequest>(TService, TRequest, Func<TService, TRequest, Object>, IRequest)​

View Source​
Declaration
public static object RunAction<TService, TRequest>(this TService service, TRequest request, Func<TService, TRequest, object> invokeAction, IRequest requestContext = null)
where TService : IService
Returns​

System.Object

Parameters​
TypeName
<TService>service
<TRequest>request
System.Func<<TService>,<TRequest>,System.Object>invokeAction
ServiceStack.Web.IRequestrequestContext
Type Parameters​
  • TService
  • TRequest