C# 클래스 MySql.Web.SessionState.MySqlSessionStateStore

This class allows ASP.NET applications to store and manage session state information in a MySQL database. Expired session data is periodically deleted from the database.
상속: System.Web.SessionState.SessionStateStoreProviderBase
파일 보기 프로젝트 열기: elevate/mysqlconnector-.net 1 사용 예제들

Private Properties

프로퍼티 타입 설명
CheckStorageEngine void
CleanupOldSessions void
Deserialize System.Web.SessionState.SessionStateStoreData
GetCleanupInterval int
GetSessionStoreItem System.Web.SessionState.SessionStateStoreData
HandleMySqlException void
Serialize byte[]

공개 메소드들

메소드 설명
CreateNewStoreData ( System context, int timeout ) : System.Web.SessionState.SessionStateStoreData

This method creates a new SessionStateStoreData object for the current request.

CreateUninitializedItem ( System context, string id, int timeout ) : void

This method adds a new session state item to the database.

Dispose ( ) : void

This method releases all the resources for this instance.

EndRequest ( System context ) : void

This method allows the MySqlSessionStateStore object to perform any cleanup that may be required for the current request.

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

This method returns a read-only session item from the database.

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

This method locks a session item and returns it from the database

Initialize ( string name, NameValueCollection config ) : void

Initializes the provider with the property values specified in the ASP.NET application configuration file

InitializeRequest ( System context ) : void

This method performs any per-request initializations that the MySqlSessionStateStore provider requires.

ReleaseItemExclusive ( System context, string id, object lockId ) : void

This method forcibly releases the lock on a session item in the database, if multiple attempts to retrieve the session item fail.

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

This method removes the specified session item from the database

ResetItemTimeout ( System context, string id ) : void

This method resets the expiration date and timeout for a session item in the database.

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

This method updates the session time information in the database with the specified session item, and releases the lock.

SetItemExpireCallback ( SessionStateItemExpireCallback expireCallback ) : bool

This method returns a false value to indicate that callbacks for expired sessions are not supported.

비공개 메소드들

메소드 설명
CheckStorageEngine ( MySqlConnection con ) : void

Check storage engine used by my_aspnet_Sessions. Warn if MyISAM is used - it does not handle concurrent updates well which is important for session provider, as each access to session does an update to "expires" field.

CleanupOldSessions ( object o ) : void
Deserialize ( HttpContext context, byte serializedItems, int timeout ) : System.Web.SessionState.SessionStateStoreData

Deserialize is called by the GetSessionStoreItem method to convert the byte array stored in the blob field to a SessionStateItemCollection.

GetCleanupInterval ( MySqlConnection con ) : int
GetSessionStoreItem ( bool lockRecord, HttpContext context, string id, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actionFlags ) : System.Web.SessionState.SessionStateStoreData

GetSessionStoreItem is called by both the GetItem and GetItemExclusive methods. GetSessionStoreItem retrieves the session data from the data source. If the lockRecord parameter is true (in the case of GetItemExclusive), then GetSessionStoreItem locks the record and sets a New LockId and LockDate.

HandleMySqlException ( MySql.Data.MySqlClient.MySqlException e, string action ) : void

Handles MySql exception. If WriteExceptionsToEventLog is set, will write exception info to event log. It throws provider exception (original exception is stored as inner exception)

Serialize ( System.Web.SessionState.SessionStateItemCollection items ) : byte[]

Serialize is called by the SetAndReleaseItemExclusive method to convert the SessionStateItemCollection into a byte array to be stored in the blob field.

메소드 상세

CreateNewStoreData() 공개 메소드

This method creates a new SessionStateStoreData object for the current request.
public CreateNewStoreData ( System context, int timeout ) : System.Web.SessionState.SessionStateStoreData
context System /// The HttpContext object for the current request. ///
timeout int /// The timeout value (in minutes) for the SessionStateStoreData object that is created. ///
리턴 System.Web.SessionState.SessionStateStoreData

CreateUninitializedItem() 공개 메소드

This method adds a new session state item to the database.
public CreateUninitializedItem ( System context, string id, int timeout ) : void
context System /// The HttpContext object for the current request. ///
id string /// The session ID for the current request. ///
timeout int /// The timeout value for the current request. ///
리턴 void

Dispose() 공개 메소드

This method releases all the resources for this instance.
public Dispose ( ) : void
리턴 void

EndRequest() 공개 메소드

This method allows the MySqlSessionStateStore object to perform any cleanup that may be required for the current request.
public EndRequest ( System context ) : void
context System The HttpContext object for the current request
리턴 void

GetItem() 공개 메소드

This method returns a read-only session item from the database.
public GetItem ( System context, string id, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actions ) : System.Web.SessionState.SessionStateStoreData
context System
id string
locked bool
lockAge System.TimeSpan
lockId object
actions SessionStateActions
리턴 System.Web.SessionState.SessionStateStoreData

GetItemExclusive() 공개 메소드

This method locks a session item and returns it from the database
public GetItemExclusive ( System context, string id, bool &locked, System.TimeSpan &lockAge, object &lockId, SessionStateActions &actions ) : System.Web.SessionState.SessionStateStoreData
context System The HttpContext object for the current request
id string The session ID for the current request
locked bool /// true if the session item is locked in the database; otherwise, it is false. ///
lockAge System.TimeSpan /// TimeSpan object that indicates the amount of time the session item has been locked in the database. ///
lockId object /// A lock identifier object. ///
actions SessionStateActions /// A SessionStateActions enumeration value that indicates whether or /// not the session is uninitialized and cookieless. ///
리턴 System.Web.SessionState.SessionStateStoreData

Initialize() 공개 메소드

Initializes the provider with the property values specified in the ASP.NET application configuration file
public Initialize ( string name, NameValueCollection config ) : void
name string The name of the provider instance to initialize.
config System.Collections.Specialized.NameValueCollection Object that contains the names and values of configuration options for the provider. ///
리턴 void

InitializeRequest() 공개 메소드

This method performs any per-request initializations that the MySqlSessionStateStore provider requires.
public InitializeRequest ( System context ) : void
context System
리턴 void

ReleaseItemExclusive() 공개 메소드

This method forcibly releases the lock on a session item in the database, if multiple attempts to retrieve the session item fail.
public ReleaseItemExclusive ( System context, string id, object lockId ) : void
context System The HttpContext object for the current request.
id string The session ID for the current request.
lockId object The lock identifier for the current request.
리턴 void

RemoveItem() 공개 메소드

This method removes the specified session item from the database
public RemoveItem ( System context, string id, object lockId, System.Web.SessionState.SessionStateStoreData item ) : void
context System The HttpContext object for the current request
id string The session ID for the current request
lockId object The lock identifier for the current request.
item System.Web.SessionState.SessionStateStoreData The session item to remove from the database.
리턴 void

ResetItemTimeout() 공개 메소드

This method resets the expiration date and timeout for a session item in the database.
public ResetItemTimeout ( System context, string id ) : void
context System The HttpContext object for the current request
id string The session ID for the current request
리턴 void

SetAndReleaseItemExclusive() 공개 메소드

This method updates the session time information in the database with the specified session item, and releases the lock.
public SetAndReleaseItemExclusive ( System context, string id, System.Web.SessionState.SessionStateStoreData item, object lockId, bool newItem ) : void
context System The HttpContext object for the current request
id string The session ID for the current request
item System.Web.SessionState.SessionStateStoreData The session item containing new values to update the session item in the database with. ///
lockId object The lock identifier for the current request.
newItem bool A Boolean value that indicates whether or not the session item is new in the database. /// A false value indicates an existing item. ///
리턴 void

SetItemExpireCallback() 공개 메소드

This method returns a false value to indicate that callbacks for expired sessions are not supported.
public SetItemExpireCallback ( SessionStateItemExpireCallback expireCallback ) : bool
expireCallback SessionStateItemExpireCallback
리턴 bool