SqlMapDaoSession.cs :  » Persistence-Frameworks » iBATIS.NET » IBatisNet » DataAccess » DaoSessionHandlers » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Persistence Frameworks » iBATIS.NET 
iBATIS.NET » IBatisNet » DataAccess » DaoSessionHandlers » SqlMapDaoSession.cs

#region Apache Notice
/*****************************************************************************
 * $Header: $
 * $Revision: 513043 $
 * $Date: 2007-02-28 23:56:03 +0100 (mer., 28 fvr. 2007) $
 * 
 * iBATIS.NET Data Mapper
 * Copyright (C) 2004 - Gilles Bayon
 *  
 * 
 * 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

#region Imports

using System.Data;
using IBatisNet.Common;
using IBatisNet.DataMapper;

#endregion

namespace IBatisNet.DataAccess.DaoSessionHandlers{
  /// <summary>
  /// An SqlMappper implementation of the DataAccess Session.
  /// </summary>
  public class SqlMapDaoSession : DaoSession
  {
    #region Fields
    private ISqlMapper _sqlMap = null;
    #endregion

    #region Properties


        /// <summary>
        /// Gets the SQL map.
        /// </summary>
        /// <value>The SQL map.</value>
    public ISqlMapper SqlMap
    {
      get { return _sqlMap; }
    }


        /// <summary>
        /// The data source use by the session.
        /// </summary>
        /// <value></value>
    public override IDataSource DataSource
    {
      get { return _sqlMap.LocalSession.DataSource; }
    }


        /// <summary>
        /// The Connection use by the session.
        /// </summary>
        /// <value></value>
    public override IDbConnection Connection
    {
      get { return _sqlMap.LocalSession.Connection; }
    }


        /// <summary>
        /// The Transaction use by the session.
        /// </summary>
        /// <value></value>
    public override IDbTransaction Transaction
    {
      get { return _sqlMap.LocalSession.Transaction; }
    }

        /// <summary>
        /// Indicates if a transaction is open  on
        /// the session.
        /// </summary>
        /// <value></value>
        public override bool IsTransactionStart
        {
            get { return _sqlMap.LocalSession.IsTransactionStart; }
        }

    #endregion

    #region Constructor (s) / Destructor
    /// <summary>
    /// 
    /// </summary>
    /// <param name="daoManager"></param>
    /// <param name="sqlMap"></param>
    public SqlMapDaoSession(DaoManager daoManager, ISqlMapper sqlMap):base(daoManager) 
    {
      _sqlMap = sqlMap;
    }
    #endregion

    #region Methods

    /// <summary>
    /// Complete (commit) a transaction
    /// </summary>
    /// <remarks>
    /// Use in 'using' syntax.
    /// </remarks>
    public override void Complete()
    {
      _sqlMap.LocalSession.Complete();
    }

    /// <summary>
    /// Opens a database connection.
    /// </summary>
    public override void OpenConnection()
    {
      _sqlMap.OpenConnection();
    }

    /// <summary>
    /// Open a connection, on the specified connection string.
    /// </summary>
    /// <param name="connectionString">The connection string</param>
    public override void OpenConnection(string connectionString)
    {
      _sqlMap.OpenConnection(connectionString);
    }

    /// <summary>
    /// Closes the connection
    /// </summary>
    public override void CloseConnection()
    {
      _sqlMap.CloseConnection();
    }

    /// <summary>
    /// Begins a transaction.
    /// </summary>
    public override void BeginTransaction()
    {
      _sqlMap.BeginTransaction();
    }

    /// <summary>
    /// Open a connection and begin a transaction on the specified connection string.
    /// </summary>
    /// <param name="connectionString">The connection string</param>
    public override void BeginTransaction(string connectionString)
    {
      _sqlMap.BeginTransaction( connectionString );    
    }

    /// <summary>
    /// Begins a database transaction
    /// </summary>
    /// <param name="openConnection">Open a connection.</param>
    public override void BeginTransaction(bool openConnection)
    {
      _sqlMap.BeginTransaction(openConnection);
    }

    /// <summary>
    /// Begins a transaction at the data source with the specified IsolationLevel value.
    /// </summary>
    /// <param name="isolationLevel">The transaction isolation level for this connection.</param>
    public override void BeginTransaction(IsolationLevel isolationLevel)
    {
      _sqlMap.BeginTransaction (isolationLevel);
    }

    /// <summary>
    /// Open a connection and begin a transaction on the specified connection string.
    /// </summary>
    /// <param name="connectionString">The connection string</param>
    /// <param name="isolationLevel">The transaction isolation level for this connection.</param>
    public override void BeginTransaction(string connectionString, IsolationLevel isolationLevel)
    {
      _sqlMap.BeginTransaction ( connectionString, isolationLevel );
    }

    /// <summary>
    /// Begins a transaction on the current connection
    /// with the specified IsolationLevel value.
    /// </summary>
    /// <param name="isolationLevel">The transaction isolation level for this connection.</param>
    /// <param name="openConnection">Open a connection.</param>
    public override void BeginTransaction(bool openConnection, IsolationLevel isolationLevel)
    {
      _sqlMap.BeginTransaction(openConnection, isolationLevel);
    }

    /// <summary>
    /// Begins a transaction on the current connection
    /// with the specified IsolationLevel value.
    /// </summary>
    /// <param name="isolationLevel">The transaction isolation level for this connection.</param>
    /// <param name="connectionString">The connection string</param>
    /// <param name="openConnection">Open a connection.</param>
    public override void BeginTransaction(string connectionString, bool openConnection, IsolationLevel isolationLevel)
    {
      _sqlMap.BeginTransaction( connectionString, openConnection, isolationLevel );
    }

    /// <summary>
    /// Commits the database transaction.
    /// </summary>
    /// <remarks>
    /// Will close the connection.
    /// </remarks>
    public override void CommitTransaction()
    {
      _sqlMap.CommitTransaction();
    }

    /// <summary>
    /// Commits the database transaction.
    /// </summary>
    /// <param name="closeConnection">Close the connection</param>
    public override void CommitTransaction(bool closeConnection)
    {
      _sqlMap.CommitTransaction(closeConnection);
    }

    /// <summary>
    /// Rolls back a transaction from a pending state.
    /// </summary>
    /// <remarks>
    /// Will close the connection.
    /// </remarks>
    public override void RollBackTransaction()
    {
      _sqlMap.RollBackTransaction();
    }

    /// <summary>
    /// Rolls back a transaction from a pending state.
    /// </summary>
    /// <param name="closeConnection">Close the connection</param>
    public override void RollBackTransaction(bool closeConnection)
    {
      _sqlMap.RollBackTransaction(closeConnection);
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="commandType"></param>
    /// <returns></returns>
    public override IDbCommand CreateCommand(CommandType commandType)
    {
      return _sqlMap.LocalSession.CreateCommand(commandType);
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    public override IDbDataParameter CreateDataParameter()
    {
      return _sqlMap.LocalSession.CreateDataParameter();
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    public override IDbDataAdapter CreateDataAdapter()
    {
      return _sqlMap.LocalSession.CreateDataAdapter();
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="command"></param>
    /// <returns></returns>
    public override IDbDataAdapter CreateDataAdapter(IDbCommand command)
    {
      return _sqlMap.LocalSession.CreateDataAdapter(command);
    }
    #endregion

    #region IDisposable Members
    /// <summary>
    /// Releasing, or resetting resources.
    /// </summary>
    public override void Dispose()
    {
      _sqlMap.LocalSession.Dispose();
      daoManager.Dispose();
    }
    #endregion

  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.