Пример #1
0
 public static KsDef ToCassandraKsDef(this Keyspace keyspace)
 {
     if (keyspace == null)
     {
         return(null);
     }
     return(new KsDef
     {
         Name = keyspace.Name,
         Durable_writes = keyspace.DurableWrites,
         Strategy_class = keyspace.ReplicationStrategy.Name,
         Strategy_options = keyspace.ReplicationStrategy.StrategyOptions,
         Cf_defs = (keyspace.ColumnFamilies ?? new Dictionary <string, ColumnFamily>()).Values.Select(family => family.ToCassandraCfDef(keyspace.Name)).ToList(),
     });
 }
Пример #2
0
        public static Keyspace FromCassandraKsDef(this KsDef ksDef)
        {
            if (ksDef == null)
            {
                return(null);
            }
            var keyspace = new Keyspace
            {
                Name                = ksDef.Name,
                DurableWrites       = ksDef.Durable_writes,
                ReplicationStrategy = replicationStrategyFactory.Create(ksDef),
                ColumnFamilies      = (ksDef.Cf_defs ?? new List <CfDef>()).ToDictionary(def => def.Name, def => def.FromCassandraCfDef()),
            };

            return(keyspace);
        }