コード例 #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 IndexSpecification CreateIndex(params ColumnSpecification[] columns)
        {
            var childGene = new CreateIndexGene(
                _gene,
                columns.Select(c => c.Gene),
                Prerequisites);

            EvolutionHistoryBuilder.Append(childGene);
            childGene.AddToParent();
            return(new IndexSpecification(childGene, EvolutionHistoryBuilder));
        }
コード例 #3
0
 internal IndexSpecification(CreateIndexGene gene, EvolutionHistoryBuilder evolutionHistoryBuilder) :
     base(evolutionHistoryBuilder)
 {
     _gene = gene;
 }