Created
February 14, 2012 03:06
-
-
Save kellabyte/1823050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using Cassandraemon; | |
| namespace CassandraGettingStartedSample | |
| { | |
| public class Post | |
| { | |
| public string user { get; set; } | |
| public string text { get; set; } | |
| } | |
| class CassandraemonSample | |
| { | |
| public static void GetPosts() | |
| { | |
| Console.WriteLine("Getting posts with Cassandraemon..."); | |
| using (var context = new CassandraContext( | |
| "127.0.0.1", 9160, "blog")) | |
| { | |
| CassandraEntity<List<Column>> last = null; | |
| IQueryable<CassandraEntity<List<Column>>> entities; | |
| var posts = (from x in context.ColumnList | |
| where x.ColumnFamily == "posts" && | |
| x.Column == "user" | |
| select x.ToObject<Post>()).Reverse(); | |
| foreach (var post in posts) | |
| { | |
| Console.WriteLine(string.Format( | |
| "User: {0}\tText: {1}", | |
| post.user, | |
| post.text)); | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what are the 'last' and 'entities' variables for?