예제 #1
0
        public static Gene Load(GeneMemento memento, IImmutableDictionary <BigInteger, Gene> genesByHashCode)
        {
            switch (memento.Type)
            {
            case nameof(UseSchemaGene):
                return(UseSchemaGene.FromMemento(memento, genesByHashCode));

            case nameof(CreateTableGene):
                return(CreateTableGene.FromMemento(memento, genesByHashCode));

            case nameof(CreateColumnGene):
                return(CreateColumnGene.FromMemento(memento, genesByHashCode));

            case nameof(DropColumnGene):
                return(DropColumnGene.FromMemento(memento, genesByHashCode));

            case nameof(CreatePrimaryKeyGene):
                return(CreatePrimaryKeyGene.FromMemento(memento, genesByHashCode));

            case nameof(CreateUniqueIndexGene):
                return(CreateUniqueIndexGene.FromMemento(memento, genesByHashCode));

            case nameof(CreateIndexGene):
                return(CreateIndexGene.FromMemento(memento, genesByHashCode));

            case nameof(CreateForeignKeyGene):
                return(CreateForeignKeyGene.FromMemento(memento, genesByHashCode));

            case nameof(CustomSqlGene):
                return(CustomSqlGene.FromMemento(memento, genesByHashCode));

            default:
                throw new ArgumentException($"Unknown type {memento.Type}");
            }
        }
예제 #2
0
        public SchemaSpecification UseSchema(string schemaName)
        {
            var gene = new UseSchemaGene(_databaseName, schemaName, Prerequisites);

            EvolutionHistoryBuilder.Append(gene);
            gene.AddToParent();
            return(new SchemaSpecification(gene, EvolutionHistoryBuilder));
        }
 internal SchemaSpecification(UseSchemaGene gene, EvolutionHistoryBuilder evolutionHistoryBuilder) :
     base(evolutionHistoryBuilder)
 {
     _gene = gene;
 }