Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

thanks to Igor for pointing out I didn't consistantly impliment Super…

… Columns. Hopefully this checkin resolves the issues https://groups.google.com/d/msg/fluentcassandra/IQ2rXeXVdLM/dZH6aoYBrwwJ
  • Loading branch information...
commit 6a1efba71754369083881f0a91f201deff1c6bfa 1 parent 2358f8a
@nberardi nberardi authored
View
2  src/FluentCassandra.nuspec
@@ -2,7 +2,7 @@
<package>
<metadata>
<id>FluentCassandra</id>
- <version>1.1.1</version>
+ <version>1.1.2</version>
<title>Fluent Cassandra</title>
<authors>Nick Berardi</authors>
<owners>Managed Fusion, LLC</owners>
View
13 src/FluentSuperColumn.cs
@@ -115,12 +115,15 @@ internal set
{
get
{
- var value = GetColumnValue(columnName);
-
- if (value is NullType)
+ object value;
+ if (!TryGetColumn(columnName, out value))
throw new CassandraException(String.Format("Column, {0}, could not be found.", columnName));
- return value;
+ return (CassandraObject)value;
+ }
+ set
+ {
+ TrySetColumn(columnName, value);
}
}
@@ -209,7 +212,7 @@ public override bool TryGetColumn(object name, out object result)
{
result = GetColumnValue(name);
- return true;
+ return !(result is NullType);
}
/// <summary>
View
21 src/FluentSuperColumnFamily.cs
@@ -79,6 +79,27 @@ public CassandraObject Key
/// <summary>
///
/// </summary>
+ /// <param name="columnName"></param>
+ /// <returns></returns>
+ public FluentSuperColumn this[CassandraObject columnName]
+ {
+ get
+ {
+ object value;
+ if (!TryGetColumn(columnName, out value))
+ throw new CassandraException(String.Format("Super Column, {0}, could not be found.", columnName));
+
+ return (FluentSuperColumn)value;
+ }
+ set
+ {
+ TrySetColumn(columnName, value);
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
/// <returns></returns>
public FluentSuperColumn CreateSuperColumn()
{
View
17 test/FluentCassandra.Sandbox/Program.cs
@@ -267,8 +267,8 @@ private static void CreateComments()
var commentsFamily = db.GetSuperColumnFamily("Comments");
ConsoleHeader("create comments");
- dynamic postComments = commentsFamily.CreateRecord(key: key);
-
+ var postComments = commentsFamily.CreateRecord(key: key);
+
// lets attach it to the database before we add the comments
db.Attach(postComments);
@@ -277,11 +277,14 @@ private static void CreateComments()
// add 5 comments
for (int i = 0; i < 5; i++)
{
- dynamic comment = postComments.CreateSuperColumn();
- comment.Name = "Nick Berardi";
- comment.Email = "nick@coderjournal.com";
- comment.Website = "www.coderjournal.com";
- comment.Comment = "Wow fluent cassandra is really great and easy to use.";
+ var comment = postComments.CreateSuperColumn();
+ comment["Name"] = "Nick Berardi";
+ comment["Email"] = "nick@coderjournal.com";
+
+ // you can also use it as a dynamic object
+ dynamic dcomment = comment;
+ dcomment.Website = "www.coderjournal.com";
+ dcomment.Comment = "Wow fluent cassandra is really great and easy to use.";
var commentPostedOn = dt;
postComments[commentPostedOn] = comment;
Please sign in to comment.
Something went wrong with that request. Please try again.