Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added the ability to delete

  • Loading branch information...
commit 0a195d69b5c74f176c0ef0af72dbcddc2afad7f4 1 parent 9da35f5
@gillotte gillotte authored
Showing with 19 additions and 7 deletions.
  1. +19 −7 src/FluentColumnFamily.cs
View
26 src/FluentColumnFamily.cs
@@ -251,13 +251,25 @@ public override bool TrySetColumn(object name, object value)
public void DeleteColumn(object name)
{
- var schema = GetSchema().Columns.First(c => c.Name == name);
-
- FluentColumn col = new FluentColumn(schema);
- col.ColumnName = CassandraObject.GetCassandraObjectFromObject(name, schema.NameType);
- col.SetParent(GetSelf());
-
- MutationTracker.ColumnMutated(MutationType.Removed, col);
+ var cfSchema = GetSchema();
+ var schema = cfSchema.Columns.FirstOrDefault(c => c.Name == name);
+
+ if(schema != null)
+ {
+ FluentColumn col = new FluentColumn(schema);
+ col.ColumnName = CassandraObject.GetCassandraObjectFromObject(name, schema.NameType);
+ col.SetParent(GetSelf());
+
+ MutationTracker.ColumnMutated(MutationType.Removed, col);
+ }
+ else
+ {
+ FluentColumn col = new FluentColumn();
+ col.ColumnName = CassandraObject.GetCassandraObjectFromObject(name);
+ col.SetParent(GetSelf());
+
+ MutationTracker.ColumnMutated(MutationType.Removed, col);
+ }
}
public override string ToString()
Please sign in to comment.
Something went wrong with that request. Please try again.