コード例 #1
0
ファイル: Sql2005RequestLog.cs プロジェクト: tresat/LogEm
        /// <summary>
        /// Initializes a new instance of the <see cref="Sql2005RequestLog"/> class
        /// to use a specific connection string for connecting to the database.
        /// </summary>
        public Sql2005RequestLog(string connectionString, string applicationName)
        {
            // If there is no connection string to use then throw an
            // exception to abort construction.
            if (connectionString == null)
                throw new ArgumentNullException("Connection string is null for the SQL Request log.");

            if (connectionString.Length == 0)
                throw new ArgumentException("Connection string is empty for the SQL Request log.");

            _connectionString = connectionString;
            _dc = new LogEmDataContext(_connectionString);

            // Set the application name as this implementation provides
            // per-application isolation over a single store.
            SetupAppName(applicationName);
        }
コード例 #2
0
ファイル: Sql2005RequestLog.cs プロジェクト: tresat/LogEm
        /// <summary>
        /// Initializes a new instance of the <see cref="Sql2005RequestLog"/> class
        /// using a dictionary of configured settings.
        /// </summary>
        public Sql2005RequestLog(IDictionary pConfig)
        {
            if (pConfig == null)
                throw new ArgumentNullException("config");

            string connectionString = ConnectionStringHelper.GetConnectionString(pConfig);

            // If there is no connection string to use then throw an
            // exception to abort construction.
            if (connectionString.Length == 0)
                throw new ApplicationException("Connection string is empty for the SQL Request log.");

            _connectionString = connectionString;
            _dc = new LogEmDataContext(_connectionString);

            // Set the application name as this implementation provides
            // per-application isolation over a single store.
            SetupAppName(pConfig["applicationName"] as string);
        }