public override ValueGenerator Select(IProperty property, IEntityType entityType)
        {
            Check.NotNull(property, nameof(property));
            Check.NotNull(entityType, nameof(entityType));

            return(property.GetValueGeneratorFactory() == null &&
                   property.Oracle().ValueGenerationStrategy == OracleValueGenerationStrategy.SequenceHiLo
                ? _sequenceFactory.Create(property, Cache.GetOrAddSequenceState(property), _connection)
                : base.Select(property, entityType));
        }
示例#2
0
        /// <summary>
        /// 选择
        /// </summary>
        /// <param name="property">属性</param>
        /// <param name="entityType">实体类型</param>
        /// <returns></returns>
        public override ValueGenerator Select(IProperty property, IEntityType entityType)
        {
            try
            {
                if (Check.IsTraceEnabled(m_oracleLogger?.Logger))
                {
                    Trace <DbLoggerCategory.Update> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Entry, OracleTraceClassName.OracleValueGeneratorSelector, OracleTraceFuncName.Select);
                }

                Check.NotNull(property, nameof(property));
                Check.NotNull(entityType, nameof(entityType));
                return((property.GetValueGeneratorFactory() == null && property.Oracle().ValueGenerationStrategy == OracleValueGenerationStrategy.SequenceHiLo) ? _sequenceFactory.Create(property, Cache.GetOrAddSequenceState(property), _connection) : base.Select(property, entityType));
            }
            catch (Exception ex)
            {
                if (Check.IsErrorEnabled(m_oracleLogger?.Logger))
                {
                    Trace <DbLoggerCategory.Update> .Write(m_oracleLogger, LogLevel.Error, OracleTraceTag.Error, OracleTraceClassName.OracleValueGeneratorSelector, OracleTraceFuncName.Select, ex.ToString());
                }
                throw;
            }
            finally
            {
                if (Check.IsTraceEnabled(m_oracleLogger?.Logger))
                {
                    Trace <DbLoggerCategory.Update> .Write(m_oracleLogger, LogLevel.Trace, OracleTraceTag.Exit, OracleTraceClassName.OracleValueGeneratorSelector, OracleTraceFuncName.Select);
                }
            }
        }