Skip to content
Browse files

fixed up some issues I had with one off methods for reseting the muta…

…tion tracker
  • Loading branch information...
1 parent dc74549 commit 24ea5211efbb92f7749c485250ac9baf11b788c9 @nberardi nberardi committed Sep 9, 2012
Showing with 12 additions and 19 deletions.
  1. +4 −1 src/CassandraContext.cs
  2. +1 −1 src/FluentColumnFamily.cs
  3. +1 −16 src/FluentRecord.cs
  4. +6 −1 src/FluentSuperColumn.cs
View
5 src/CassandraContext.cs
@@ -306,9 +306,12 @@ public void SaveChanges()
/// <param name="record"></param>
public void SaveChanges(IFluentRecord record)
{
- var mutations = record.MutationTracker.GetMutations();
+ var tracker = record.MutationTracker;
+ var mutations = tracker.GetMutations();
var op = new BatchMutate(mutations);
ExecuteOperation(op);
+
+ tracker.Clear();
}
/// <summary>
View
2 src/FluentColumnFamily.cs
@@ -227,7 +227,7 @@ public override bool TrySetColumn(object name, object value)
var col = Columns.FirstOrDefault(c => c.ColumnName == name);
var mutationType = MutationType.Changed;
- // if column doesn't exisit create it and add it to the columns
+ // if column doesn't exist create it and add it to the columns
if (col == null)
{
mutationType = MutationType.Added;
View
17 src/FluentRecord.cs
@@ -107,7 +107,7 @@ public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract bool TrySetColumn(object name, object value);
- private bool SuppressMutationTracking { get; set; }
+ protected bool SuppressMutationTracking { get; private set; }
void ILoadable.BeginLoad()
{
@@ -178,21 +178,6 @@ public void RemoveColumn(object name)
Columns.Remove(col);
}
- protected void ResetMutation()
- {
- MutationTracker.Clear();
- }
-
- protected void ResetMutationAndAddAllColumns()
- {
- if (SuppressMutationTracking)
- return;
-
- ResetMutation();
- foreach (var col in Columns)
- MutationTracker.ColumnMutated(MutationType.Added, col);
- }
-
#endregion
}
}
View
7 src/FluentSuperColumn.cs
@@ -267,7 +267,12 @@ private void UpdateParent(FluentColumnParent parent)
foreach (var col in Columns)
col.SetParent(columnParent);
- ResetMutationAndAddAllColumns();
+ if (!SuppressMutationTracking) {
+ MutationTracker.Clear();
+
+ foreach (var col in Columns)
+ MutationTracker.ColumnMutated(MutationType.Added, col);
+ }
}
#region IFluentBaseColumn Members

0 comments on commit 24ea521

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