public OracleMigrationsSqlGenerator(
     [NotNull] MigrationsSqlGeneratorDependencies dependencies,
     [NotNull] IOracleOptions options)
     : base(dependencies)
 {
     _options = options;
 }
 public OracleQuerySqlGeneratorFactory(
     [NotNull] QuerySqlGeneratorDependencies dependencies,
     [NotNull] IOracleOptions sqlServerOptions)
     : base(dependencies)
 {
     _sqlServerOptions = sqlServerOptions;
 }
 public OracleValueGeneratorSelector(
     [NotNull] ValueGeneratorSelectorDependencies dependencies,
     [NotNull] IOracleOptions options)
     : base(dependencies)
 {
     _options = options;
 }
Exemplo n.º 4
0
 public OracleSmartTypeMapper(
     [NotNull] RelationalTypeMapperDependencies dependencies,
     [NotNull] IOracleOptions options)
     : base(dependencies)
 {
     Check.NotNull(options, nameof(options));
     _options = options;
 }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="dependencies">查询SQL生成器依赖</param>
        /// <param name="oracleOptions">选项</param>
        /// <param name="logger">日志</param>
        public OracleQuerySqlGeneratorFactory(
            [NotNull] QuerySqlGeneratorDependencies dependencies,
            [NotNull] IOracleOptions oracleOptions,
            IDiagnosticsLogger <DbLoggerCategory.Query> logger = null)
            : base(dependencies)
        {
            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Query> .Write(logger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleQuerySqlGeneratorFactory, OracleTraceFuncName.ctor);
            }

            m_oracleLogger = logger;
            _oracleOptions = oracleOptions;

            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Query> .Write(logger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleQuerySqlGeneratorFactory, OracleTraceFuncName.ctor);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 实例化
        /// </summary>
        /// <param name="dependencies">编译上下文依赖</param>
        /// <param name="relationalDependencies">关系编译上下文依赖</param>
        /// <param name="options">选项</param>
        /// <param name="logger">日志</param>
        public OracleQueryCompilationContextFactory(
            [NotNull] QueryCompilationContextDependencies dependencies,
            [NotNull] RelationalQueryCompilationContextDependencies relationalDependencies,
            [NotNull] IOracleOptions options,
            IDiagnosticsLogger <DbLoggerCategory.Query> logger = null)
            : base(dependencies, relationalDependencies)
        {
            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Query> .Write(logger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleQueryCompilationContextFactory, OracleTraceFuncName.ctor);
            }

            if (options != null && options.OracleSQLCompatibility != null)
            {
                _oracleSQLCompatibility = options.OracleSQLCompatibility;
            }
            m_oracleLogger = logger;

            if (Check.IsTraceEnabled(logger?.Logger))
            {
                Trace <DbLoggerCategory.Query> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleQueryCompilationContextFactory, OracleTraceFuncName.ctor);
            }
        }
 public OracleMigrationsSqlGeneratorSpacer([NotNull] MigrationsSqlGeneratorDependencies dependencies, [NotNull] IOracleOptions options, IDiagnosticsLogger <DbLoggerCategory.Migrations> logger = null)
     : base(dependencies, options, logger)
 {
     try
     {
         if (logger != null && logger.Logger != null && logger.Logger.IsEnabled(LogLevel.Trace))
         {
             Trace <DbLoggerCategory.Migrations> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleMigrationsSqlGenerator, OracleTraceFuncName.ctor);
         }
         if (options != null && options.OracleSQLCompatibility != null)
         {
             _oracleSQLCompatibility = options.OracleSQLCompatibility;
         }
         m_oracleLogger = logger;
         if (_oracleSQLCompatibility == "11")
         {
             MaxIdentifierLengthBytes = 30;
         }
         else
         {
             MaxIdentifierLengthBytes = 128;
         }
     }
     catch (Exception ex)
     {
         if (logger != null && logger.Logger != null && logger.Logger.IsEnabled(LogLevel.Error))
         {
             Trace <DbLoggerCategory.Migrations> .Write(logger, LogLevel.Error, OracleTraceTag.Error, OracleTraceClassName.OracleMigrationsSqlGenerator, OracleTraceFuncName.ctor, ex.ToString());
         }
         throw;
     }
     finally
     {
         if (logger != null && logger.Logger != null && logger.Logger.IsEnabled(LogLevel.Trace))
         {
             Trace <DbLoggerCategory.Migrations> .Write(logger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleMigrationsSqlGenerator, OracleTraceFuncName.ctor);
         }
     }
 }
Exemplo n.º 8
0
 public RivenOracleTypeMappingSource([NotNull] TypeMappingSourceDependencies dependencies, [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies, [NotNull] IOracleOptions oracleOptions)
     : base(dependencies, relationalDependencies, oracleOptions)
 {
 }
 public OracleSequentialGuidValueGenerator(IOracleOptions options)
 {
     _options = options;
 }
#pragma warning disable EF1001 // Internal EF Core API usage.
        public ShardingOracleMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, IOracleOptions options) : base(dependencies, options)
#pragma warning restore EF1001 // Internal EF Core API usage.
        {
        }
 public ShardingOracleMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, IOracleOptions options) : base(dependencies, options)
 {
 }
Exemplo n.º 12
0
 public OracleQuerySqlGeneratorFactorySpacer([NotNull] QuerySqlGeneratorDependencies dependencies, [NotNull] IOracleOptions oracleOptions, IDiagnosticsLogger <DbLoggerCategory.Query> logger = null)
     : base(dependencies, oracleOptions, logger)
 {
     m_oracleLogger = logger;
     _oracleOptions = oracleOptions;
 }
        /// <summary>
        /// 实例化类型映射源
        /// </summary>
        /// <param name="dependencies">类型映射源</param>
        /// <param name="relationalDependencies">关系类型映射源</param>
        /// <param name="oracleOptions">选项</param>
        /// <param name="logger">日志</param>
        public OracleTypeMappingSource(
            [NotNull] TypeMappingSourceDependencies dependencies,
            [NotNull] RelationalTypeMappingSourceDependencies relationalDependencies,
            [NotNull] IOracleOptions oracleOptions,
            IDiagnosticsLogger <DbLoggerCategory.Model> logger = null)
            : base(dependencies, relationalDependencies)
        {
            m_oracleLogger = logger;
            if (oracleOptions != null && oracleOptions.OracleSQLCompatibility != null)
            {
                _oracleSQLCompatibility = oracleOptions.OracleSQLCompatibility;
            }

            string oracleSQLCompatibility = _oracleSQLCompatibility;

            _xml = new OracleStringTypeMapping("XML", null, oracleSQLCompatibility, unicode: true);
            _fixedLengthUnicodeString = new OracleStringTypeMapping("NCHAR", oracleSQLCompatibility: _oracleSQLCompatibility, dbType: DbType.String, unicode: true, size: null, fixedLength: true);

            oracleSQLCompatibility       = _oracleSQLCompatibility;
            _variableLengthUnicodeString = new OracleStringTypeMapping("NVARCHAR2", null, oracleSQLCompatibility, unicode: true);
            _fixedLengthAnsiString       = new OracleStringTypeMapping("CHAR", oracleSQLCompatibility: _oracleSQLCompatibility, dbType: DbType.AnsiString, unicode: false, size: null, fixedLength: true);
            _variableLengthAnsiString    = new OracleStringTypeMapping("VARCHAR2", oracleSQLCompatibility: _oracleSQLCompatibility, dbType: DbType.AnsiString);
            _timeYTM = new OracleStringTypeMapping("INTERVAL YEAR(2) TO MONTH", oracleSQLCompatibility: _oracleSQLCompatibility, dbType: DbType.String);

            oracleSQLCompatibility = _oracleSQLCompatibility;
            _urowID = new OracleStringTypeMapping("UROWID", null, oracleSQLCompatibility);

            if (Check.IsTraceEnabled(m_oracleLogger?.Logger))
            {
                Trace <DbLoggerCategory.Model> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleTypeMappingSource, OracleTraceFuncName.ctor);
            }

            // 通用语言运行时类型映射表,通用语言运行时(CLR)支持的数据类型与数据库支持的类型之间的映射
            _clrTypeMappings = new Dictionary <Type, RelationalTypeMapping>
            {
                { typeof(bool), _bool },
                { typeof(sbyte), _sbyte },
                { typeof(byte), _byte },
                { typeof(short), _short },
                { typeof(ushort), _ushort },
                { typeof(int), _int },
                { typeof(uint), _uint },
                { typeof(long), _long },
                { typeof(ulong), _ulong },
                { typeof(float), _float },
                { typeof(double), _double },
                { typeof(decimal), _decimal },
                { typeof(DateTime), _datetime },
                { typeof(DateTimeOffset), _datetimeoffset3 },
                { typeof(TimeSpan), _time },
                { typeof(Guid), _guid }
            };

            // 存储类型映射表, 模型上的类型名称注解(TypeName)与数据库支持的类型之间的映射
            _storeTypeMappings = new Dictionary <string, RelationalTypeMapping>(StringComparer.OrdinalIgnoreCase)
            {
                { "number(1)", _bool },
                { "number(3)", _byte },
                { "number(5)", _short },
                { "number(10)", _int },
                { "number(19)", _long },
                { "number(17,4)", _real },
                { "number(26,9)", _real },                 // 兼容
                { "number(29,9)", _decimal },
                { "decimal(17,4)", _real },
                { "decimal(29,9)", _decimal },
                { "binary_integer", _int },
                { "binary_float", _float },
                { "binary_double", _double },
                { "char", _fixedLengthAnsiString },
                { "nchar", _fixedLengthUnicodeString },
                { "varchar2", _variableLengthAnsiString },
                { "nvarchar2", _variableLengthUnicodeString },
                { "long", _variableLengthAnsiString },
                { "long raw", _variableLengthBinary },
                { "clob", _unboundedAnsiString },
                { "nclob", _unboundedUnicodeString },
                { "blob", _variableLengthBinary },
                { "bfile", _variableLengthBinary },
                { "date", _date },
                { "timestamp", _datetime },
                { "timestamp(0) with time zone", _datetimeoffset },
                { "timestamp(1) with time zone", _datetimeoffset },
                { "timestamp(2) with time zone", _datetimeoffset },
                { "timestamp(3) with time zone", _datetimeoffset3 },
                { "timestamp(4) with time zone", _datetimeoffset },
                { "timestamp(5) with time zone", _datetimeoffset },
                { "timestamp(6) with time zone", _datetimeoffset },
                { "timestamp(7) with time zone", _datetimeoffset },
                { "timestamp(8) with time zone", _datetimeoffset },
                { "timestamp(9) with time zone", _datetimeoffset },
                { "timestamp with time zone", _datetimeoffset },
                { "timestamp(0) with local time zone", _datetimeoffsetlocal },
                { "timestamp(1) with local time zone", _datetimeoffsetlocal },
                { "timestamp(2) with local time zone", _datetimeoffsetlocal },
                { "timestamp(3) with local time zone", _datetimeoffsetlocal },
                { "timestamp(4) with local time zone", _datetimeoffsetlocal },
                { "timestamp(5) with local time zone", _datetimeoffsetlocal },
                { "timestamp(6) with local time zone", _datetimeoffsetlocal },
                { "timestamp(7) with local time zone", _datetimeoffsetlocal },
                { "timestamp(8) with local time zone", _datetimeoffsetlocal },
                { "timestamp(9) with local time zone", _datetimeoffsetlocal },
                { "timestamp with local time zone", _datetimeoffsetlocal },
                { "interval", _time },
                { "interval day", _time },
                { "interval year", _timeYTM },
                { "ROWID", _fixedLengthAnsiString },
                { "UROWID", _urowID },
                { "XMLTYPE", _xml },
                { "xml", _xml }
            };

            if (Check.IsTraceEnabled(m_oracleLogger?.Logger))
            {
                Trace <DbLoggerCategory.Model> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleTypeMappingSource, OracleTraceFuncName.ctor);
            }
        }