Beispiel #1
0
        public JConnect(IDbConnection connection)
        {
            this.connection = connection;
              commandTimeout = 30;
              Type type = connection.GetType();

              if (type == typeof(System.Data.Odbc.OdbcConnection))
              {
            typeOfParameter = ParameterType.QuestionMark;
            typeOfVendor = VendorType.Odbc;
              }
              else if (type == typeof(System.Data.OleDb.OleDbConnection))
              {
            typeOfParameter = ParameterType.QuestionMark;
            typeOfVendor = VendorType.OleDb;
              }
              else if (type == typeof(System.Data.SqlClient.SqlConnection))
              {
            typeOfParameter = ParameterType.AtSymbol;
            typeOfVendor = VendorType.SqlServer;
            GetReturningProc += new GetReturningHandler(SqlServerReturning);
              }
              else
              {
            typeOfParameter = ParameterType.Colon;
            typeOfVendor = VendorType.Oracle;
            GetReturningProc += new GetReturningHandler(OracleReturning);
              }
              GetTimeStampProc += new GetTimeStampHandler(DefaultGetTimeStampProc);
        }
Beispiel #2
0
        /// <summary>
        /// Set up Portal connection
        /// </summary>
        /// <param name="connection">Db Connection</param>
        /// <param name="handler">Handel logging and credentials</param>
        /// <param name="queryToLong">Will log long running queries as warning</param>
        public JConnect(IDbConnection connection, PortalHandlerBase handler = null, int queryToLong = 5)
        {
            this.connection  = connection;
            this.handler     = handler;
            this.queryToLong = queryToLong;

            commandTimeout = 300;
            Type type = connection.GetType();

            if (type == typeof(System.Data.Odbc.OdbcConnection))
            {
                TypeOfVendor = VendorType.Odbc;
            }
            else if (type == typeof(System.Data.OleDb.OleDbConnection))
            {
                TypeOfVendor = VendorType.OleDb;
            }
            else if (type == typeof(System.Data.SqlClient.SqlConnection))
            {
                TypeOfVendor = VendorType.SqlServer;
            }
            else if (type == typeof(System.Data.SQLite.SQLiteConnection))
            {
                TypeOfVendor = VendorType.Lite3;
            }
            else
            {
                TypeOfVendor = VendorType.Oracle;
            }
            GetTimeStampProc = DefaultGetTimeStampProc;
            GetUserStampProc = DefaultGetUserStampProc;
        }
Beispiel #3
0
        /// <summary>
        /// Set up Portal connection
        /// </summary>
        /// <param name="connection">Db Connection</param>
        /// <param name="handler">Handel logging and credentials</param>
        /// <param name="queryToLong">Will log long running queries as warning</param>
        public Connect(IDbConnection connection, PortalHandlerBase handler = null, int queryToLong = 5)
        {
            this.connection = connection;
            this.handler = handler;
            this.queryToLong = queryToLong;

            commandTimeout = 300;
            Type type = connection.GetType();
            if (type == typeof(System.Data.Odbc.OdbcConnection))
                TypeOfVendor = VendorType.Odbc;
            else if (type == typeof(System.Data.OleDb.OleDbConnection))
                TypeOfVendor = VendorType.OleDb;
            else if (type == typeof(System.Data.SqlClient.SqlConnection))
                TypeOfVendor = VendorType.SqlServer;
            else if (type == typeof(System.Data.SQLite.SQLiteConnection))
                TypeOfVendor = VendorType.Lite3;
            else
                TypeOfVendor = VendorType.Oracle;
            GetTimeStampProc = DefaultGetTimeStampProc;
            GetUserStampProc = DefaultGetUserStampProc;
        }