예제 #1
0
        private static void SetupKeyspace()
        {
            using (var db = new CassandraContext(keyspace: keyspaceName, server: server))
            {
                if (!db.KeyspaceExists(keyspaceName))
                {
                    db.AddKeyspace(new KsDef {
                        Name = keyspaceName,
                        Replication_factor = 1,
                        Strategy_class     = "org.apache.cassandra.locator.SimpleStrategy",
                        Cf_defs            = new List <CfDef>()
                    });
                }

                if (!db.Keyspace.ColumnFamilyExists("Posts"))
                {
                    db.AddColumnFamily(new CfDef {
                        Name               = "Posts",
                        Keyspace           = keyspaceName,
                        Column_type        = "Super",
                        Comparator_type    = "UTF8Type",
                        Subcomparator_type = "UTF8Type",
                        Comment            = "Used for blog posts."
                    });
                }
            }
        }
예제 #2
0
        private static void SetupKeyspace()
        {
            using (var db = new CassandraContext(keyspace: keyspaceName, server: server))
            {
                if (!db.KeyspaceExists(keyspaceName))
                    db.AddKeyspace(new KsDef {
                        Name = keyspaceName,
                        Replication_factor = 1,
                        Strategy_class = "org.apache.cassandra.locator.SimpleStrategy",
                        Cf_defs = new List<CfDef>()
                    });

                if (!db.Keyspace.ColumnFamilyExists("Posts"))
                    db.AddColumnFamily(new CfDef {
                        Name = "Posts",
                        Keyspace = keyspaceName,
                        Column_type = "Super",
                        Comparator_type = "UTF8Type",
                        Subcomparator_type = "UTF8Type",
                        Comment = "Used for blog posts."
                    });
            }
        }