Ejemplo n.º 1
0
 public static CreateUniqueIndexGene FromMemento(GeneMemento memento, IImmutableDictionary <BigInteger, Gene> genesByHashCode)
 {
     return(new CreateUniqueIndexGene(
                (CreateTableGene)genesByHashCode[memento.Prerequisites["Parent"].Single()],
                memento.Prerequisites["Columns"].Select(p => genesByHashCode[p]).OfType <CreateColumnGene>(),
                memento.Prerequisites["Prerequisites"].Select(x => genesByHashCode[x]).ToImmutableList()));
 }
 public static CreateTableGene FromMemento(GeneMemento memento, IImmutableDictionary <BigInteger, Gene> genesByHashCode)
 {
     return(new CreateTableGene(
                (UseSchemaGene)genesByHashCode[memento.Prerequisites["Parent"].Single()],
                memento.Attributes["TableName"],
                memento.Prerequisites["Prerequisites"].Select(p => genesByHashCode[p]).ToImmutableList()));
 }
Ejemplo n.º 3
0
 public static UseSchemaGene FromMemento(GeneMemento memento, IImmutableDictionary <BigInteger, Gene> genesByHashCode)
 {
     return(new UseSchemaGene(
                memento.Attributes["DatabaseName"],
                memento.Attributes["SchemaName"],
                memento.Prerequisites["Prerequisites"].Select(p => genesByHashCode[p]).ToImmutableList()));
 }
Ejemplo n.º 4
0
        private string GenerateGeneValue(GeneMemento gene)
        {
            string attributes = JsonConvert.SerializeObject(gene.Attributes);
            string hex        = $"0x{gene.HashCode.ToString("X64")}";

            return($@"
    ('{gene.Type}', {hex}, '{attributes.Replace("'", "''")}')");
        }
 public static CreateColumnGene FromMemento(GeneMemento memento, IImmutableDictionary <BigInteger, Gene> genesByHashCode)
 {
     return(new CreateColumnGene(
                (CreateTableGene)genesByHashCode[memento.Prerequisites["Parent"].Single()],
                memento.Attributes["ColumnName"],
                memento.Attributes["TypeDescriptor"],
                memento.Attributes["Nullable"] == "true",
                memento.Prerequisites["Prerequisites"].Select(x => genesByHashCode[x]).ToImmutableList()));
 }
Ejemplo n.º 6
0
 public static CreateForeignKeyGene FromMemento(GeneMemento memento, IImmutableDictionary <BigInteger, Gene> genesByHashCode)
 {
     return(new CreateForeignKeyGene(
                (CreateIndexGene)genesByHashCode[memento.Prerequisites["Parent"].Single()],
                (CreatePrimaryKeyGene)genesByHashCode[memento.Prerequisites["Referencing"].Single()],
                memento.Attributes["CascadeDelete"] == "true",
                memento.Attributes["CascaseUpdate"] == "true",
                memento.Prerequisites["Prerequisites"].Select(x => genesByHashCode[x]).ToImmutableList()));
 }
Ejemplo n.º 7
0
        private static GeneMemento LoadMemento(LookaheadEnumerator <EvolutionHistoryRow> enumerator)
        {
            var type       = enumerator.Current.Type;
            var hashCode   = enumerator.Current.HashCode;
            var attributes = enumerator.Current.Attributes;
            var roles      = LoadRoles(hashCode, enumerator);

            var geneAttributes = JsonConvert.DeserializeObject <Dictionary <string, string> >(attributes);
            var memento        = new GeneMemento(
                type,
                geneAttributes,
                hashCode,
                roles);

            return(memento);
        }
 public static DropColumnGene FromMemento(GeneMemento memento, IImmutableDictionary <BigInteger, Gene> genesByHashCode)
 {
     return(new DropColumnGene(
                (CreateColumnGene)genesByHashCode[memento.Prerequisites["Parent"].Single()],
                memento.Prerequisites["Prerequisites"].Select(x => genesByHashCode[x]).ToImmutableList()));
 }