Пример #1
0
 protected virtual void ValidateNonKeyValueGeneration([NotNull] IModel model)
 {
     foreach (var property in model.GetEntityTypes()
              .SelectMany(t => t.GetDeclaredProperties())
              .Where(
                  p =>
                  ((OraclePropertyAnnotations)p.Oracle()).GetOracleValueGenerationStrategy(fallbackToModel: false) == OracleValueGenerationStrategy.SequenceHiLo &&
                  !p.IsKey()))
     {
         throw new InvalidOperationException(
                   OracleStrings.NonKeyValueGeneration(property.Name, property.DeclaringEntityType.DisplayName()));
     }
 }
Пример #2
0
        protected override void ValidateSharedColumnsCompatibility(IReadOnlyList <IEntityType> mappedTypes, string tableName)
        {
            base.ValidateSharedColumnsCompatibility(mappedTypes, tableName);

            var identityColumns = mappedTypes.SelectMany(et => et.GetDeclaredProperties())
                                  .Where(p => p.Oracle().ValueGenerationStrategy == OracleValueGenerationStrategy.IdentityColumn)
                                  .Distinct((p1, p2) => p1.Name == p2.Name)
                                  .ToList();

            if (identityColumns.Count > 1)
            {
                var sb = new StringBuilder()
                         .AppendJoin(identityColumns.Select(p => "'" + p.DeclaringEntityType.DisplayName() + "." + p.Name + "'"));
                throw new InvalidOperationException(OracleStrings.MultipleIdentityColumns(sb, tableName));
            }
        }
        protected override void ValidateSharedTableCompatibility(
            IReadOnlyList <IEntityType> mappedTypes, string tableName)
        {
            var firstMappedType   = mappedTypes[0];
            var isMemoryOptimized = firstMappedType.Oracle().IsMemoryOptimized;

            foreach (var otherMappedType in mappedTypes.Skip(1))
            {
                if (isMemoryOptimized != otherMappedType.Oracle().IsMemoryOptimized)
                {
                    throw new InvalidOperationException(
                              OracleStrings.IncompatibleTableMemoryOptimizedMismatch(
                                  tableName, firstMappedType.DisplayName(), otherMappedType.DisplayName(),
                                  isMemoryOptimized ? firstMappedType.DisplayName() : otherMappedType.DisplayName(),
                                  !isMemoryOptimized ? firstMappedType.DisplayName() : otherMappedType.DisplayName()));
                }
            }

            base.ValidateSharedTableCompatibility(mappedTypes, tableName);
        }