예제 #1
0
        internal static SqlRewriter GetRewriter(SqlDialect dialect)
        {
            if (HasRewriters)
            {
                var type = dialect.GetType();
                if (Rewriters.ContainsKey(type))
                {
                    return(Rewriters[type]);
                }
            }

            return(null);
        }
예제 #2
0
        void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
        {
            // save...
            Type dialectType = null;

            if (_dialect != null)
            {
                dialectType = _dialect.GetType();
            }
            info.AddValue("_dialectType", dialectType);

            // others...
            info.AddValue("_databaseName", _databaseName);
            info.AddValue("_parameters", _parameters);
            info.AddValue("_commandText", _commandText);
            info.AddValue("_commandType", _commandType);
            info.AddValue("_selectMap", _selectMap);
            info.AddValue("Tag", this.Tag);
            info.AddValue("ArrayParameterType", this.ArrayParameterType);
        }
예제 #3
0
        public AdoNetConnectionFactory(string connectionString, string providerName)
        {
            _connectionString = connectionString;
            _factory          = DbProviderFactories.GetFactory(providerName);
            _dialect          = SqlDialect.GetDialectFor(_factory, connectionString);

            if (_dialect == null)
            {
                throw new InvalidOperationException($"Unable to guess dialect for: {connectionString}");
            }

            _log.Info("Created new connection factory for {0}, using dialect {1}.", _factory.GetType().Name, _dialect.GetType().Name);
        }