using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
namespace DBFactory
{
    public class SQLServerDBFactory:DBFactory
    {
        SqlConnection conn = new SqlConnection();
        public override IDbConnection GetDBConnection()
        {
            return conn;
        }
        public override IDbTransaction GetDBTransaction(IsolationLevel LockAction)
        {

            return conn.BeginTransaction(LockAction);
        }
        public override IDbCommand GetDBCommand()
        {
            return new SqlCommand();
        }
        public override IDbCommand GetDBCommand(string cmdText,IDbConnection conn1)
        {
            return new SqlCommand(cmdText,(SqlConnection)conn1);
        }
        public override IDbDataAdapter GetDataAdapter(IDbCommand dbc)
        {
            return new SqlDataAdapter((SqlCommand)dbc);
        }
        public override IDbDataAdapter GetDataAdapter()
        {
            return new SqlDataAdapter();
        }
        public override IDbDataParameter GetParameter()
        {
            return new SqlParameter();
        }
        public override IDbDataParameter GetParameter(string ParameterName,DbType dbtype)
        {
            IDbDataParameter dbdp=new SqlParameter(ParameterName,(SqlDbType ) dbtype);
            return dbdp;
        }
        public override IDataReader GetDataReader(IDbCommand dbc)
        {
            return ((SqlCommand)dbc).ExecuteReader();
        }
    }
}
