Skip to content
This repository
Browse code

added the ability to delete

  • Loading branch information...
commit 0a195d69b5c74f176c0ef0af72dbcddc2afad7f4 1 parent 9da35f5
gillotte authored September 09, 2012

Showing 1 changed file with 19 additions and 7 deletions. Show diff stats Hide diff stats

  1. 26  src/FluentColumnFamily.cs
26  src/FluentColumnFamily.cs
@@ -251,13 +251,25 @@ public override bool TrySetColumn(object name, object value)
251 251
 
252 252
         public void DeleteColumn(object name)
253 253
         {
254  
-            var schema = GetSchema().Columns.First(c => c.Name == name);
255  
-
256  
-            FluentColumn col = new FluentColumn(schema);
257  
-            col.ColumnName = CassandraObject.GetCassandraObjectFromObject(name, schema.NameType);
258  
-            col.SetParent(GetSelf());
259  
-
260  
-            MutationTracker.ColumnMutated(MutationType.Removed, col);
  254
+            var cfSchema = GetSchema();
  255
+            var schema = cfSchema.Columns.FirstOrDefault(c => c.Name == name);
  256
+
  257
+            if(schema != null)
  258
+            {
  259
+                FluentColumn col = new FluentColumn(schema);
  260
+                col.ColumnName = CassandraObject.GetCassandraObjectFromObject(name, schema.NameType);
  261
+                col.SetParent(GetSelf());
  262
+
  263
+                MutationTracker.ColumnMutated(MutationType.Removed, col);
  264
+            }
  265
+            else
  266
+            {
  267
+                FluentColumn col = new FluentColumn();
  268
+                col.ColumnName = CassandraObject.GetCassandraObjectFromObject(name);
  269
+                col.SetParent(GetSelf());
  270
+
  271
+                MutationTracker.ColumnMutated(MutationType.Removed, col);
  272
+            }
261 273
         }
262 274
 
263 275
 		public override string ToString()

0 notes on commit 0a195d6

Please sign in to comment.
Something went wrong with that request. Please try again.