예제 #1
0
        public OracleOrmLiteDialectProvider(bool compactGuid, bool quoteNames, string clientProvider = ManagedProvider)
        {
            // Make managed provider work with CaptureSqlFilter, safe since Oracle providers don't support async
            OrmLiteContext.UseThreadStatic = true;
            // Not nice to slow down, but need to read some types via Oracle-specific read methods so can't read all fields in single call
            OrmLiteConfig.DeoptimizeReader = true;
            ClientProvider          = clientProvider;
            QuoteNames              = quoteNames;
            AutoIncrementDefinition = string.Empty;

            ParamString = ":";

            NamingStrategy = new OracleNamingStrategy(MaxNameLength);
            ExecFilter     = new OracleExecFilter();

            _factory            = DbProviderFactories.GetFactory(ClientProvider);
            _timestampConverter = new OracleTimestampConverter(_factory.GetType(), ClientProvider);

            InitColumnTypeMap();

            //Special Converters if you need to override default behavior
            base.EnumConverter = new OracleEnumConverter();

            if (compactGuid)
            {
                RegisterConverter <Guid>(new OracleCompactGuidConverter());
            }
            else
            {
                RegisterConverter <Guid>(new OracleGuidConverter());
            }

            RegisterConverter <TimeSpan>(new OracleTimeSpanAsIntConverter());
            RegisterConverter <string>(new OracleStringConverter());
            RegisterConverter <char[]>(new OracleCharArrayConverter());
            RegisterConverter <byte[]>(new OracleByteArrayConverter());

            RegisterConverter <long>(new OracleInt64Converter());
            RegisterConverter <sbyte>(new OracleSByteConverter());
            RegisterConverter <ushort>(new OracleUInt16Converter());
            RegisterConverter <uint>(new OracleUInt32Converter());
            RegisterConverter <ulong>(new OracleUInt64Converter());

            RegisterConverter <float>(new OracleFloatConverter());
            RegisterConverter <double>(new OracleDoubleConverter());
            RegisterConverter <decimal>(new OracleDecimalConverter());

            RegisterConverter <DateTime>(new OracleDateTimeConverter());
            RegisterConverter <DateTimeOffset>(new OracleDateTimeOffsetConverter(_timestampConverter));
            RegisterConverter <bool>(new OracleBoolConverter());

            this.Variables = new Dictionary <string, string>
            {
                { OrmLiteVariables.SystemUtc, "sys_extract_utc(systimestamp)" },
                { OrmLiteVariables.MaxText, "VARCHAR2(2000)" },
                { OrmLiteVariables.MaxTextUnicode, "NVARCHAR2(2000)" },
                { OrmLiteVariables.True, SqlBool(true) },
                { OrmLiteVariables.False, SqlBool(false) },
            };
        }
예제 #2
0
        public OracleOrmLiteDialectProvider(bool compactGuid, bool quoteNames, string clientProvider = OdpProvider)
        {
            ClientProvider                 = clientProvider;
            CompactGuid                    = compactGuid;
            QuoteNames                     = quoteNames;
            BoolColumnDefinition           = "NUMBER(1)";
            GuidColumnDefinition           = CompactGuid ? CompactGuidDefinition : StringGuidDefinition;
            LongColumnDefinition           = "NUMERIC(18)";
            AutoIncrementDefinition        = string.Empty;
            DateTimeColumnDefinition       = "TIMESTAMP";
            DateTimeOffsetColumnDefinition = "TIMESTAMP WITH TIME ZONE";
            TimeColumnDefinition           = LongColumnDefinition;
            RealColumnDefinition           = "FLOAT";
            // Order-dependency here: must set following values before setting DefaultStringLength
            StringLengthNonUnicodeColumnDefinitionFormat = "VARCHAR2({0})";
            StringLengthUnicodeColumnDefinitionFormat    = "NVARCHAR2({0})";
            MaxStringColumnDefinition = StringLengthNonUnicodeColumnDefinitionFormat.Fmt(MaxStringColumnLength);
            DefaultStringLength       = 128;

            InitColumnTypeMap();
            ParamString = ":";

            NamingStrategy = new OracleNamingStrategy(MaxNameLength);
            ExecFilter     = new OracleExecFilter();
        }
예제 #3
0
        public Oracle11OrmLiteDialectProvider()
        {
            NamingStrategy = new OracleNamingStrategy(MaxNameLength);

            RegisterConverter <String>(new Oracle12StringConverter());
        }