This project is read-only.

Getting Started

Basic Operation

using(var context = new CassandraContext("localhost", 9160, "KeySpace1"))
        // Target type is Column, ColumnList, SuperColumn or SuperColumnList
        // x is CassandraEntity class that have a variety of convert method
	var products = from x in context.ColumnList    
		       where x.Key == "1" &&
			     x.ColumnFamily == "Product"
		       select x.ToObject<Product>();    
	foreach(Product p in products)

First, You must create CassandraContext instance. It require host, port, keyspace.

Next, Write LINQ logic. You can specify datasource Column, ColumnList, SuperColumn, SuperColumnList. Example, You specify Column, it return IQueryable<CassandraEntity<Column>> instance. If you choice other type, Column is replaced.

CassandraEntity is important type. It has 'ColumnFamily', 'Key', 'SuperColumn', 'Column' fields. And they are used for where condition. And CassandraEntity has 'Data' field that stored retrieved data. Type of 'Data' field is specify by generic parameter.

In Addition, CassandraEntity have convert method 'ToObject', 'ToObjectList' and so on. They convert "Column, ColumnList, SuperColumn, SuperColumnList" to "object, List, Dictionary". You can use them in select phrase and other various scene.

Last edited Oct 6, 2011 at 4:50 PM by sabro, version 1


No comments yet.