This project has moved. For the latest updates, please go here.

Session management

Zyan Framework supports complex and flexible session management. Session manager carries the following:
  • Ensures authentication through the entire call chain
  • Caches session variables

Zyan is shipped with two built-in session managers. Both classes reside in Zyan.Communication.SessionMgmt namespace.

Class name Description
InProcSessionManager (Default) Session data is stored in the server's process memory. This option is highly effective, but is not suitable for multi-server cluster. This is the best choice for small and mid-size projects.
SqlSessionManager Session data is stored in SQL database. It allows to share session data between several servers. This option is somewhat slower because session data has to be received from server.

You can choose the desired session management strategy by passing session manager instance to ZyanHost constructor. By default (for example, if you supply NULL), InProcSessionManager class will be used.

SqlSessionManager usage example

var protocol = new TcpBinaryServerProtocolSetup() { TcpPort = 8080 };

// SQL Server connection string
var connectionString = "Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;";

// Set up SQL session manager. Sessions table name: "Session", variables table name: "SessionVar", schema: "dbo"
var sessionManager = new SqlSessionManager(connectionString, "dbo", "Session", "SessionVar");

// Run host with SQL session manager
var host = new ZyanHost("ExampleHost", protocol, sessionManager);
You can write your own session manager by implementing ISessionManager interface.

Last edited Mar 27, 2011 at 5:08 PM by yallie, version 8


No comments yet.