#region Apache Notice
/*****************************************************************************
* $Header: $
* $Revision: 513043 $
* $Date$
*
* iBATIS.NET Data Mapper
* Copyright (C) 2008/2005 - The Apache Software Foundation
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************/
#endregion
using System.Data;
using System;
using Apache.Ibatis.DataMapper.Session.Transaction;
namespace Apache.Ibatis.DataMapper.Session
{
///
/// The DataMapper Session contract
///
public interface ISession : IDisposable
{
///
/// Get the that created this instance.
///
ISessionFactory SessionFactory { get; }
///
/// Gets the ADO.NET connection.
///
///
/// Applications are responsible for calling commit/rollback upon the connection before
/// closing the ISession.
///
IDbConnection Connection { get; }
///
/// Opens the connection.
///
/// The connection provided by the DataMapper
IDbConnection OpenConnection();
///
/// End the ISession by disconnecting from the ADO.NET connection and cleaning up.
///
/// The connection provided by the DataMapper or
IDbConnection Close();
///
/// Begin a unit of work and return the associated ITransaction object.
///
/// A transaction instance
ITransaction BeginTransaction();
///
/// Begin a transaction with the specified isolationLevel
///
/// Isolation level for the new transaction
/// A transaction instance having the specified isolation level
ITransaction BeginTransaction(IsolationLevel isolationLevel);
///
/// Get the current associated ITransaction object.
///
ITransaction Transaction { get; }
}
}