Base Interface for ISession and IStatelessSession
Description
Environment
None
duplicates
Activity
Show:
Duplicate
Details
Details
Assignee

Reporter

Components
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created March 21, 2011 at 10:07 AM
Updated October 3, 2013 at 6:39 AM
Resolved October 3, 2013 at 6:39 AM
Who's Looking?
Sometimes it is useful to be able to use some basic session functionalities without knowing if they are implemented by an ISession or an IStatelessSession. So, I propose creating a new interface, something like ICommonSession or IBaseSession, containing the declaration of the common functionality between ISession and IStatelessSession, which would implement this new interface.
The declaration would be something like:
public interface ICommonSession
{
IDbConnection Connection { get; }
bool IsConnected { get; }
bool IsOpen { get; }
ITransaction Transaction { get; }
ITransaction BeginTransaction();
ITransaction BeginTransaction(IsolationLevel isolationLevel);
IDbConnection Close();
ICriteria CreateCriteria<T>() where T : class;
ICriteria CreateCriteria<T>(string alias) where T : class;
ICriteria CreateCriteria(string entityName);
ICriteria CreateCriteria(System.Type entityType);
ICriteria CreateCriteria(string entityName, string alias);
ICriteria CreateCriteria(System.Type entityType, string alias);
IQuery CreateQuery(string queryString);
ISQLQuery CreateSQLQuery(string queryString);
void Delete(object entity);
T Get<T>(object id);
T Get<T>(object id, LockMode lockMode);
IQuery GetNamedQuery(string queryName);
IQueryOver<T, T> QueryOver<T>() where T : class;
IQueryOver<T, T> QueryOver<T>(Expression<Func<T>> alias) where T : class;
void Refresh(object entity);
void Refresh(object entity, LockMode lockMode);
void Update(object entity);
}