C# Класс Raven.AspNet.SessionState.RavenSessionStateStoreProvider

An ASP.NET session-state store-provider implementation (http://msdn.microsoft.com/en-us/library/ms178588.aspx) using RavenDb (http://ravendb.net) for persistence.
Наследование: System.Web.SessionState.SessionStateStoreProviderBase, IDisposable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
Deserialize System.Web.SessionState.SessionStateStoreData
GetSessionStaticObjects System.Web.HttpStaticObjectsCollection
GetSessionStoreItem System.Web.SessionState.SessionStateStoreData
Initialize void
Serialize string

Открытые методы

Метод Описание
CreateNewStoreData ( HttpContext context, int timeout ) : System.Web.SessionState.SessionStateStoreData

returns a new SessionStateStoreData object with an empty ISessionStateItemCollection object, an HttpStaticObjectsCollection collection, and the specified Timeout value.

CreateUninitializedItem ( HttpContext context, string sessionId, int timeout ) : void

Adds an uninitialized item to the session data store.

Dispose ( ) : void
EndRequest ( HttpContext context ) : void

Performs any cleanup required by your session-state store provider.

GetItem ( HttpContext context, string sessionId, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actions ) : System.Web.SessionState.SessionStateStoreData

This method performs the same work as the GetItemExclusive method, except that it does not attempt to lock the session item in the data store.

GetItemExclusive ( HttpContext context, string sessionId, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actions ) : System.Web.SessionState.SessionStateStoreData

Retrieves session values and information from the session data store and locks the session-item data at the data store for the duration of the request.

Initialize ( string name, System config ) : void
InitializeRequest ( HttpContext context ) : void

Performs any initialization required by your session-state store provider.

RavenSessionStateStoreProvider ( ) : System

Public parameterless constructor

RavenSessionStateStoreProvider ( IDocumentStore documentStore ) : System

Constructor accepting a document store instance, used for testing.

ReleaseItemExclusive ( HttpContext context, string sessionId, object lockId ) : void

Releases the lock on an item in the session data store.

RemoveItem ( HttpContext context, string sessionId, object lockId, System.Web.SessionState.SessionStateStoreData item ) : void

deletes the session information from the data store where the data store item matches the supplied SessionID value, the current application, and the supplied lock identifier.

ResetItemTimeout ( HttpContext context, string sessionId ) : void

Resets the expiry timeout for a session item.

SetAndReleaseItemExclusive ( HttpContext context, string sessionId, System.Web.SessionState.SessionStateStoreData item, object lockId, bool newItem ) : void

If the newItem parameter is true, the SetAndReleaseItemExclusive method inserts a new item into the data store with the supplied values. Otherwise, the existing item in the data store is updated with the supplied values, and any lock on the data is released.

SetItemExpireCallback ( SessionStateItemExpireCallback expireCallback ) : bool

Takes as input a delegate that references the Session_OnEnd event defined in the Global.asax file. If the session-state store provider supports the Session_OnEnd event, a local reference to the SessionStateItemExpireCallback parameter is set and the method returns true; otherwise, the method returns false.

Приватные методы

Метод Описание
Deserialize ( HttpContext context, string serializedItems, int timeout ) : System.Web.SessionState.SessionStateStoreData
GetSessionStaticObjects ( HttpContext context ) : System.Web.HttpStaticObjectsCollection
GetSessionStoreItem ( bool lockRecord, HttpContext context, string sessionId, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actionFlags ) : System.Web.SessionState.SessionStateStoreData
Initialize ( string name, System config, IDocumentStore documentStore ) : void
Serialize ( System.Web.SessionState.SessionStateItemCollection items ) : string

Описание методов

CreateNewStoreData() публичный Метод

returns a new SessionStateStoreData object with an empty ISessionStateItemCollection object, an HttpStaticObjectsCollection collection, and the specified Timeout value.
public CreateNewStoreData ( HttpContext context, int timeout ) : System.Web.SessionState.SessionStateStoreData
context System.Web.HttpContext The HttpContext instance for the current request
timeout int The expiry timeout in minutes.
Результат System.Web.SessionState.SessionStateStoreData

CreateUninitializedItem() публичный Метод

Adds an uninitialized item to the session data store.
public CreateUninitializedItem ( HttpContext context, string sessionId, int timeout ) : void
context System.Web.HttpContext The HttpContext instance for the current request
sessionId string The session identifier.
timeout int The expiry timeout in minutes.
Результат void

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

EndRequest() публичный Метод

Performs any cleanup required by your session-state store provider.
public EndRequest ( HttpContext context ) : void
context System.Web.HttpContext The HttpContext instance for the current request
Результат void

GetItem() публичный Метод

This method performs the same work as the GetItemExclusive method, except that it does not attempt to lock the session item in the data store.
public GetItem ( HttpContext context, string sessionId, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actions ) : System.Web.SessionState.SessionStateStoreData
context System.Web.HttpContext The HttpContext instance for the current request
sessionId string The session identifier.
locked bool An output parameter indicating whether the item is currently exclusively locked.
lockAge System.TimeSpan The age of the exclusive lock (if present)
lockId object The identifier of the exclusive lock (if present)
actions SessionStateActions Used with sessions whose Cookieless property is true, /// when the regenerateExpiredSessionId attribute is set to true. /// An actionFlags value set to InitializeItem (1) indicates that the entry in the session data store is a /// new session that requires initialization.
Результат System.Web.SessionState.SessionStateStoreData

GetItemExclusive() публичный Метод

Retrieves session values and information from the session data store and locks the session-item data at the data store for the duration of the request.
public GetItemExclusive ( HttpContext context, string sessionId, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actions ) : System.Web.SessionState.SessionStateStoreData
context System.Web.HttpContext The HttpContext instance for the current request
sessionId string The session identifier.
locked bool An output parameter indicating whether the item is currently exclusively locked.
lockAge System.TimeSpan The age of the exclusive lock (if present)
lockId object The identifier of the exclusive lock (if present)
actions SessionStateActions Used with sessions whose Cookieless property is true, /// when the regenerateExpiredSessionId attribute is set to true. /// An actionFlags value set to InitializeItem (1) indicates that the entry in the session data store is a /// new session that requires initialization.
Результат System.Web.SessionState.SessionStateStoreData

Initialize() публичный Метод

public Initialize ( string name, System config ) : void
name string
config System
Результат void

InitializeRequest() публичный Метод

Performs any initialization required by your session-state store provider.
public InitializeRequest ( HttpContext context ) : void
context System.Web.HttpContext The HttpContext instance for the current request
Результат void

RavenSessionStateStoreProvider() публичный Метод

Public parameterless constructor
public RavenSessionStateStoreProvider ( ) : System
Результат System

RavenSessionStateStoreProvider() публичный Метод

Constructor accepting a document store instance, used for testing.
public RavenSessionStateStoreProvider ( IDocumentStore documentStore ) : System
documentStore IDocumentStore
Результат System

ReleaseItemExclusive() публичный Метод

Releases the lock on an item in the session data store.
public ReleaseItemExclusive ( HttpContext context, string sessionId, object lockId ) : void
context System.Web.HttpContext The HttpContext instance for the current request
sessionId string The session identifier.
lockId object The lock identifier for the current request.
Результат void

RemoveItem() публичный Метод

deletes the session information from the data store where the data store item matches the supplied SessionID value, the current application, and the supplied lock identifier.
public RemoveItem ( HttpContext context, string sessionId, object lockId, System.Web.SessionState.SessionStateStoreData item ) : void
context System.Web.HttpContext The HttpContext instance for the current request
sessionId string The session identifier.
lockId object The exclusive-lock identifier.
item System.Web.SessionState.SessionStateStoreData
Результат void

ResetItemTimeout() публичный Метод

Resets the expiry timeout for a session item.
public ResetItemTimeout ( HttpContext context, string sessionId ) : void
context System.Web.HttpContext The HttpContext instance for the current request
sessionId string The session identifier.
Результат void

SetAndReleaseItemExclusive() публичный Метод

If the newItem parameter is true, the SetAndReleaseItemExclusive method inserts a new item into the data store with the supplied values. Otherwise, the existing item in the data store is updated with the supplied values, and any lock on the data is released.
public SetAndReleaseItemExclusive ( HttpContext context, string sessionId, System.Web.SessionState.SessionStateStoreData item, object lockId, bool newItem ) : void
context System.Web.HttpContext The HttpContext instance for the current request
sessionId string The session identifier.
item System.Web.SessionState.SessionStateStoreData The current session values to be stored
lockId object The lock identifier for the current request.
newItem bool If true, a new item is inserted into the store. Otherwise, the existing item in /// the data store is updated with the supplied values, and any lock on the data is released.
Результат void

SetItemExpireCallback() публичный Метод

Takes as input a delegate that references the Session_OnEnd event defined in the Global.asax file. If the session-state store provider supports the Session_OnEnd event, a local reference to the SessionStateItemExpireCallback parameter is set and the method returns true; otherwise, the method returns false.
public SetItemExpireCallback ( SessionStateItemExpireCallback expireCallback ) : bool
expireCallback SessionStateItemExpireCallback A callback.
Результат bool