SqlNetTiersProvider.cs :  » Template-Engines » netTiers » PetShop » Data » SqlClient » 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 » Template Engines » netTiers 
netTiers » PetShop » Data » SqlClient » SqlNetTiersProvider.cs

#region Using directives

using System;
using System.Collections;
using System.Collections.Specialized;


using System.Web.Configuration;
using System.Data;
using System.Data.Common;
using System.Configuration.Provider;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

using PetShop.Business;
using PetShop.Data;
using PetShop.Data.Bases;

#endregion

namespace PetShop.Data.SqlClient{
  /// <summary>
  /// This class is the Sql implementation of the NetTiersProvider.
  /// </summary>
  public sealed class SqlNetTiersProvider : PetShop.Data.Bases.NetTiersProvider
  {
    private static object syncRoot = new Object();
    private string _applicationName;
        private string _connectionString;
        private bool _useStoredProcedure;
        string _providerInvariantName;
    
    /// <summary>
    /// Initializes a new instance of the <see cref="SqlNetTiersProvider"/> class.
    ///</summary>
    public SqlNetTiersProvider()
    {  
    }    
    
    /// <summary>
        /// Initializes the provider.
        /// </summary>
        /// <param name="name">The friendly name of the provider.</param>
        /// <param name="config">A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.</param>
        /// <exception cref="T:System.ArgumentNullException">The name of the provider is null.</exception>
        /// <exception cref="T:System.InvalidOperationException">An attempt is made to call <see cref="M:System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection)"></see> on a provider after the provider has already been initialized.</exception>
        /// <exception cref="T:System.ArgumentException">The name of the provider has a length of zero.</exception>
    public override void Initialize(string name, NameValueCollection config)
        {
            // Verify that config isn't null
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            // Assign the provider a default name if it doesn't have one
            if (String.IsNullOrEmpty(name))
            {
                name = "SqlNetTiersProvider";
            }

            // Add a default "description" attribute to config if the
            // attribute doesn't exist or is empty
            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "NetTiers Sql provider");
            }

            // Call the base class's Initialize method
            base.Initialize(name, config);

            // Initialize _applicationName
            _applicationName = config["applicationName"];

            if (string.IsNullOrEmpty(_applicationName))
            {
                _applicationName = "/";
            }
            config.Remove("applicationName");


            #region "Initialize UseStoredProcedure"
            string storedProcedure  = config["useStoredProcedure"];
             if (string.IsNullOrEmpty(storedProcedure))
            {
                throw new ProviderException("Empty or missing useStoredProcedure");
            }
            this._useStoredProcedure = Convert.ToBoolean(config["useStoredProcedure"]);
            config.Remove("useStoredProcedure");
            #endregion

      #region ConnectionString

      // Initialize _connectionString
      _connectionString = config["connectionString"];
      config.Remove("connectionString");

      string connect = config["connectionStringName"];
      config.Remove("connectionStringName");

      if ( String.IsNullOrEmpty(_connectionString) )
      {
        if ( String.IsNullOrEmpty(connect) )
        {
          throw new ProviderException("Empty or missing connectionStringName");
        }

        if ( DataRepository.ConnectionStrings[connect] == null )
        {
          throw new ProviderException("Missing connection string");
        }

        _connectionString = DataRepository.ConnectionStrings[connect].ConnectionString;
      }

            if ( String.IsNullOrEmpty(_connectionString) )
            {
                throw new ProviderException("Empty connection string");
      }

      #endregion
            
             #region "_providerInvariantName"

            // initialize _providerInvariantName
            this._providerInvariantName = config["providerInvariantName"];

            if (String.IsNullOrEmpty(_providerInvariantName))
            {
                throw new ProviderException("Empty or missing providerInvariantName");
            }
            config.Remove("providerInvariantName");

            #endregion

        }
    
    /// <summary>
    /// Creates a new <see cref="TransactionManager"/> instance from the current datasource.
    /// </summary>
    /// <returns></returns>
    public override TransactionManager CreateTransaction()
    {
      return new TransactionManager(this._connectionString);
    }
    
    /// <summary>
    /// Gets a value indicating whether to use stored procedure or not.
    /// </summary>
    /// <value>
    ///   <c>true</c> if this repository use stored procedures; otherwise, <c>false</c>.
    /// </value>
    public bool UseStoredProcedure
    {
      get {return this._useStoredProcedure;}
      set {this._useStoredProcedure = value;}
    }
    
     /// <summary>
        /// Gets or sets the connection string.
        /// </summary>
        /// <value>The connection string.</value>
    public string ConnectionString
    {
      get {return this._connectionString;}
      set {this._connectionString = value;}
    }
    
    /// <summary>
      /// Gets or sets the invariant provider name listed in the DbProviderFactories machine.config section.
      /// </summary>
      /// <value>The name of the provider invariant.</value>
      public string ProviderInvariantName
      {
          get { return this._providerInvariantName; }
          set { this._providerInvariantName = value; }
      }    
    
    ///<summary>
    /// Indicates if the current <see cref="NetTiersProvider"/> implementation supports Transacton.
    ///</summary>
    public override bool IsTransactionSupported
    {
      get
      {
        return true;
      }
    }

    
    #region "OrderStatusProvider"
      
    private SqlOrderStatusProvider innerSqlOrderStatusProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="OrderStatus"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override OrderStatusProviderBase OrderStatusProvider
    {
      get
      {
        if (innerSqlOrderStatusProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlOrderStatusProvider == null)
            {
              this.innerSqlOrderStatusProvider = new SqlOrderStatusProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlOrderStatusProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlOrderStatusProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlOrderStatusProvider SqlOrderStatusProvider
    {
      get {return OrderStatusProvider as SqlOrderStatusProvider;}
    }
    
    #endregion
    
    
    #region "CartProvider"
      
    private SqlCartProvider innerSqlCartProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Cart"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override CartProviderBase CartProvider
    {
      get
      {
        if (innerSqlCartProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlCartProvider == null)
            {
              this.innerSqlCartProvider = new SqlCartProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlCartProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlCartProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlCartProvider SqlCartProvider
    {
      get {return CartProvider as SqlCartProvider;}
    }
    
    #endregion
    
    
    #region "OrderProvider"
      
    private SqlOrderProvider innerSqlOrderProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Order"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override OrderProviderBase OrderProvider
    {
      get
      {
        if (innerSqlOrderProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlOrderProvider == null)
            {
              this.innerSqlOrderProvider = new SqlOrderProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlOrderProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlOrderProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlOrderProvider SqlOrderProvider
    {
      get {return OrderProvider as SqlOrderProvider;}
    }
    
    #endregion
    
    
    #region "InventoryProvider"
      
    private SqlInventoryProvider innerSqlInventoryProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Inventory"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override InventoryProviderBase InventoryProvider
    {
      get
      {
        if (innerSqlInventoryProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlInventoryProvider == null)
            {
              this.innerSqlInventoryProvider = new SqlInventoryProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlInventoryProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlInventoryProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlInventoryProvider SqlInventoryProvider
    {
      get {return InventoryProvider as SqlInventoryProvider;}
    }
    
    #endregion
    
    
    #region "SupplierProvider"
      
    private SqlSupplierProvider innerSqlSupplierProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Supplier"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override SupplierProviderBase SupplierProvider
    {
      get
      {
        if (innerSqlSupplierProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlSupplierProvider == null)
            {
              this.innerSqlSupplierProvider = new SqlSupplierProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlSupplierProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlSupplierProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlSupplierProvider SqlSupplierProvider
    {
      get {return SupplierProvider as SqlSupplierProvider;}
    }
    
    #endregion
    
    
    #region "CategoryProvider"
      
    private SqlCategoryProvider innerSqlCategoryProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Category"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override CategoryProviderBase CategoryProvider
    {
      get
      {
        if (innerSqlCategoryProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlCategoryProvider == null)
            {
              this.innerSqlCategoryProvider = new SqlCategoryProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlCategoryProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlCategoryProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlCategoryProvider SqlCategoryProvider
    {
      get {return CategoryProvider as SqlCategoryProvider;}
    }
    
    #endregion
    
    
    #region "ProductProvider"
      
    private SqlProductProvider innerSqlProductProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Product"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override ProductProviderBase ProductProvider
    {
      get
      {
        if (innerSqlProductProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlProductProvider == null)
            {
              this.innerSqlProductProvider = new SqlProductProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlProductProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlProductProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlProductProvider SqlProductProvider
    {
      get {return ProductProvider as SqlProductProvider;}
    }
    
    #endregion
    
    
    #region "LineItemProvider"
      
    private SqlLineItemProvider innerSqlLineItemProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="LineItem"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override LineItemProviderBase LineItemProvider
    {
      get
      {
        if (innerSqlLineItemProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlLineItemProvider == null)
            {
              this.innerSqlLineItemProvider = new SqlLineItemProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlLineItemProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlLineItemProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlLineItemProvider SqlLineItemProvider
    {
      get {return LineItemProvider as SqlLineItemProvider;}
    }
    
    #endregion
    
    
    #region "AccountProvider"
      
    private SqlAccountProvider innerSqlAccountProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Account"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override AccountProviderBase AccountProvider
    {
      get
      {
        if (innerSqlAccountProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlAccountProvider == null)
            {
              this.innerSqlAccountProvider = new SqlAccountProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlAccountProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlAccountProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlAccountProvider SqlAccountProvider
    {
      get {return AccountProvider as SqlAccountProvider;}
    }
    
    #endregion
    
    
    #region "ProfileProvider"
      
    private SqlProfileProvider innerSqlProfileProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Profile"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override ProfileProviderBase ProfileProvider
    {
      get
      {
        if (innerSqlProfileProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlProfileProvider == null)
            {
              this.innerSqlProfileProvider = new SqlProfileProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlProfileProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlProfileProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlProfileProvider SqlProfileProvider
    {
      get {return ProfileProvider as SqlProfileProvider;}
    }
    
    #endregion
    
    
    #region "ItemProvider"
      
    private SqlItemProvider innerSqlItemProvider;

    ///<summary>
    /// This class is the Data Access Logic Component for the <see cref="Item"/> business entity.
    /// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
    ///</summary>
    /// <value></value>
    public override ItemProviderBase ItemProvider
    {
      get
      {
        if (innerSqlItemProvider == null) 
        {
          lock (syncRoot) 
          {
            if (innerSqlItemProvider == null)
            {
              this.innerSqlItemProvider = new SqlItemProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
            }
          }
        }
        return innerSqlItemProvider;
      }
    }
    
    /// <summary>
    /// Gets the current <see cref="SqlItemProvider"/>.
    /// </summary>
    /// <value></value>
    public SqlItemProvider SqlItemProvider
    {
      get {return ItemProvider as SqlItemProvider;}
    }
    
    #endregion
    
    
    
    #region "General data access methods"

    #region "ExecuteNonQuery"
    /// <summary>
    /// Executes the non query.
    /// </summary>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override int ExecuteNonQuery(string storedProcedureName, params object[] parameterValues)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      return database.ExecuteNonQuery(storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the non query.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override int ExecuteNonQuery(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      return database.ExecuteNonQuery(transactionManager.TransactionObject, storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the non query.
    /// </summary>
    /// <param name="commandWrapper">The command wrapper.</param>
    public override void ExecuteNonQuery(DbCommand commandWrapper)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      database.ExecuteNonQuery(commandWrapper);  
      
    }

    /// <summary>
    /// Executes the non query.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandWrapper">The command wrapper.</param>
    public override void ExecuteNonQuery(TransactionManager transactionManager, DbCommand commandWrapper)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      database.ExecuteNonQuery(commandWrapper, transactionManager.TransactionObject);  
    }


    /// <summary>
    /// Executes the non query.
    /// </summary>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override int ExecuteNonQuery(CommandType commandType, string commandText)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      return database.ExecuteNonQuery(commandType, commandText);  
    }
    /// <summary>
    /// Executes the non query.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override int ExecuteNonQuery(TransactionManager transactionManager, CommandType commandType, string commandText)
    {
      Database database = transactionManager.Database;      
      return database.ExecuteNonQuery(transactionManager.TransactionObject , commandType, commandText);        
    }
    #endregion

    #region "ExecuteDataReader"
    /// <summary>
    /// Executes the reader.
    /// </summary>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override IDataReader ExecuteReader(string storedProcedureName, params object[] parameterValues)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);      
      return database.ExecuteReader(storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the reader.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override IDataReader ExecuteReader(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
    {
      Database database = transactionManager.Database;
      return database.ExecuteReader(transactionManager.TransactionObject, storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the reader.
    /// </summary>
    /// <param name="commandWrapper">The command wrapper.</param>
    /// <returns></returns>
    public override IDataReader ExecuteReader(DbCommand commandWrapper)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);      
      return database.ExecuteReader(commandWrapper);  
    }

    /// <summary>
    /// Executes the reader.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandWrapper">The command wrapper.</param>
    /// <returns></returns>
    public override IDataReader ExecuteReader(TransactionManager transactionManager, DbCommand commandWrapper)
    {
      Database database = transactionManager.Database;
      return database.ExecuteReader(commandWrapper, transactionManager.TransactionObject);  
    }


    /// <summary>
    /// Executes the reader.
    /// </summary>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override IDataReader ExecuteReader(CommandType commandType, string commandText)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      return database.ExecuteReader(commandType, commandText);  
    }
    /// <summary>
    /// Executes the reader.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override IDataReader ExecuteReader(TransactionManager transactionManager, CommandType commandType, string commandText)
    {
      Database database = transactionManager.Database;      
      return database.ExecuteReader(transactionManager.TransactionObject , commandType, commandText);        
    }
    #endregion

    #region "ExecuteDataSet"
    /// <summary>
    /// Executes the data set.
    /// </summary>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override DataSet ExecuteDataSet(string storedProcedureName, params object[] parameterValues)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);      
      return database.ExecuteDataSet(storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the data set.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override DataSet ExecuteDataSet(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
    {
      Database database = transactionManager.Database;
      return database.ExecuteDataSet(transactionManager.TransactionObject, storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the data set.
    /// </summary>
    /// <param name="commandWrapper">The command wrapper.</param>
    /// <returns></returns>
    public override DataSet ExecuteDataSet(DbCommand commandWrapper)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);      
      return database.ExecuteDataSet(commandWrapper);  
    }

    /// <summary>
    /// Executes the data set.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandWrapper">The command wrapper.</param>
    /// <returns></returns>
    public override DataSet ExecuteDataSet(TransactionManager transactionManager, DbCommand commandWrapper)
    {
      Database database = transactionManager.Database;
      return database.ExecuteDataSet(commandWrapper, transactionManager.TransactionObject);  
    }


    /// <summary>
    /// Executes the data set.
    /// </summary>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override DataSet ExecuteDataSet(CommandType commandType, string commandText)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      return database.ExecuteDataSet(commandType, commandText);  
    }
    /// <summary>
    /// Executes the data set.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override DataSet ExecuteDataSet(TransactionManager transactionManager, CommandType commandType, string commandText)
    {
      Database database = transactionManager.Database;      
      return database.ExecuteDataSet(transactionManager.TransactionObject , commandType, commandText);        
    }
    #endregion

    #region "ExecuteScalar"
    /// <summary>
    /// Executes the scalar.
    /// </summary>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override object ExecuteScalar(string storedProcedureName, params object[] parameterValues)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);      
      return database.ExecuteScalar(storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the scalar.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="storedProcedureName">Name of the stored procedure.</param>
    /// <param name="parameterValues">The parameter values.</param>
    /// <returns></returns>
    public override object ExecuteScalar(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
    {
      Database database = transactionManager.Database;
      return database.ExecuteScalar(transactionManager.TransactionObject, storedProcedureName, parameterValues);  
    }

    /// <summary>
    /// Executes the scalar.
    /// </summary>
    /// <param name="commandWrapper">The command wrapper.</param>
    /// <returns></returns>
    public override object ExecuteScalar(DbCommand commandWrapper)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);      
      return database.ExecuteScalar(commandWrapper);  
    }

    /// <summary>
    /// Executes the scalar.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandWrapper">The command wrapper.</param>
    /// <returns></returns>
    public override object ExecuteScalar(TransactionManager transactionManager, DbCommand commandWrapper)
    {
      Database database = transactionManager.Database;
      return database.ExecuteScalar(commandWrapper, transactionManager.TransactionObject);  
    }

    /// <summary>
    /// Executes the scalar.
    /// </summary>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override object ExecuteScalar(CommandType commandType, string commandText)
    {
      SqlDatabase database = new SqlDatabase(this._connectionString);
      return database.ExecuteScalar(commandType, commandText);  
    }
    /// <summary>
    /// Executes the scalar.
    /// </summary>
    /// <param name="transactionManager">The transaction manager.</param>
    /// <param name="commandType">Type of the command.</param>
    /// <param name="commandText">The command text.</param>
    /// <returns></returns>
    public override object ExecuteScalar(TransactionManager transactionManager, CommandType commandType, string commandText)
    {
      Database database = transactionManager.Database;      
      return database.ExecuteScalar(transactionManager.TransactionObject , commandType, commandText);        
    }
    #endregion

    #endregion


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