public override ConventionSet AddConventions(ConventionSet conventionSet)
        {
            Check.NotNull(conventionSet, nameof(conventionSet));

            base.AddConventions(conventionSet);

            var valueGenerationStrategyConvention = new OracleValueGenerationStrategyConvention();

            conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention);

            ReplaceConvention(conventionSet.PropertyAddedConventions, (DatabaseGeneratedAttributeConvention)valueGenerationStrategyConvention);
            ReplaceConvention(conventionSet.PropertyFieldChangedConventions, (DatabaseGeneratedAttributeConvention)valueGenerationStrategyConvention);

            return(conventionSet);
        }
        public override ConventionSet AddConventions(ConventionSet conventionSet)
        {
            Check.NotNull(conventionSet, nameof(conventionSet));

            base.AddConventions(conventionSet);

            var valueGenerationStrategyConvention = new OracleValueGenerationStrategyConvention();

            conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention);

            ValueGeneratorConvention valueGeneratorConvention = new OracleValueGeneratorConvention();

            ReplaceConvention(conventionSet.BaseEntityTypeChangedConventions, valueGeneratorConvention);

            var oracleInMemoryTablesConvention = new OracleMemoryOptimizedTablesConvention();

            conventionSet.EntityTypeAnnotationChangedConventions.Add(oracleInMemoryTablesConvention);

            ReplaceConvention(conventionSet.PrimaryKeyChangedConventions, valueGeneratorConvention);

            conventionSet.KeyAddedConventions.Add(oracleInMemoryTablesConvention);

            ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGeneratorConvention);

            ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGeneratorConvention);

            var oracleIndexConvention = new OracleIndexConvention(_sqlGenerationHelper);

            conventionSet.IndexAddedConventions.Add(oracleInMemoryTablesConvention);
            conventionSet.IndexAddedConventions.Add(oracleIndexConvention);

            conventionSet.IndexUniquenessChangedConventions.Add(oracleIndexConvention);

            conventionSet.IndexAnnotationChangedConventions.Add(oracleIndexConvention);

            conventionSet.PropertyNullabilityChangedConventions.Add(oracleIndexConvention);

            conventionSet.PropertyAnnotationChangedConventions.Add(oracleIndexConvention);
            conventionSet.PropertyAnnotationChangedConventions.Add((OracleValueGeneratorConvention)valueGeneratorConvention);

            return(conventionSet);
        }
Пример #3
0
        /// <summary>
        /// 添加约定
        /// </summary>
        /// <param name="conventionSet">约定集</param>
        /// <returns></returns>
        public override ConventionSet AddConventions(ConventionSet conventionSet)
        {
            try
            {
                if (Check.IsTraceEnabled(m_oracleLogger?.Logger))
                {
                    Trace <DbLoggerCategory.Query> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleConventionSetBuilder, OracleTraceFuncName.AddConventions);
                }

                Check.NotNull(conventionSet, nameof(conventionSet));
                base.AddConventions(conventionSet);
                var valueGenerationStrategyConvention = new OracleValueGenerationStrategyConvention();
                conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention);
                conventionSet.ModelInitializedConventions.Add(new RelationalMaxIdentifierLengthConvention(128));
                ValueGeneratorConvention valueGeneratorConvention = new OracleValueGeneratorConvention();
                ReplaceConvention(conventionSet.BaseEntityTypeChangedConventions, valueGeneratorConvention);
                ReplaceConvention(conventionSet.PrimaryKeyChangedConventions, valueGeneratorConvention);
                ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGeneratorConvention);
                ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGeneratorConvention);
                conventionSet.PropertyAnnotationChangedConventions.Add((OracleValueGeneratorConvention)valueGeneratorConvention);
                return(conventionSet);
            }
            catch (Exception ex)
            {
                if (Check.IsErrorEnabled(m_oracleLogger?.Logger))
                {
                    Trace <DbLoggerCategory.Query> .Write(m_oracleLogger, LogLevel.Error, OracleTraceTag.Error, OracleTraceClassName.OracleConventionSetBuilder, OracleTraceFuncName.AddConventions, ex.ToString());
                }
                throw;
            }
            finally
            {
                if (Check.IsTraceEnabled(m_oracleLogger?.Logger))
                {
                    Trace <DbLoggerCategory.Query> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleConventionSetBuilder, OracleTraceFuncName.AddConventions);
                }
            }
        }
        public override ConventionSet AddConventions(ConventionSet conventionSet)
        {
            Check.NotNull(conventionSet, nameof(conventionSet));

            base.AddConventions(conventionSet);

            var valueGenerationStrategyConvention = new OracleValueGenerationStrategyConvention();

            conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention);

            ValueGeneratorConvention valueGeneratorConvention = new OracleValueGeneratorConvention();

            ReplaceConvention(conventionSet.BaseEntityTypeChangedConventions, valueGeneratorConvention);

            ReplaceConvention(conventionSet.PrimaryKeyChangedConventions, valueGeneratorConvention);

            ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGeneratorConvention);

            ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGeneratorConvention);

            conventionSet.PropertyAnnotationChangedConventions.Add((OracleValueGeneratorConvention)valueGeneratorConvention);

            return(conventionSet);
        }