コード例 #1
0
        public CassandraKeyspace(CassandraKeyspaceSchema schema, CassandraContext context)
        {
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }

            if (schema.Name == null)
            {
                throw new ArgumentException("Must specify the keyspace name.");
            }

            _keyspaceName = schema.Name;
            _cachedSchema = schema;
            _context      = context;
        }
コード例 #2
0
        public CassandraKeyspaceSchema GetSchema()
        {
            if (_cachedSchema == null)
            {
                try
                {
                    _cachedSchema = new CassandraKeyspaceSchema(_context.ExecuteOperation(new SimpleOperation <Apache.Cassandra.KsDef>(ctx => {
                        return(ctx.Session.GetClient().describe_keyspace(KeyspaceName));
                    })));
                }
                catch (CassandraOperationException exc)
                {
                    Debug.WriteLine(exc);
                    _cachedSchema = new CassandraKeyspaceSchema {
                        Name = KeyspaceName
                    };
                }
            }

            return(_cachedSchema);
        }
コード例 #3
0
 public void ClearCachedKeyspaceSchema()
 {
     _cachedSchema = null;
 }