/// <summary> /// Call the SaveChanges method on the context /// and index any changes /// </summary> /// <returns>Value passed back from the SaveChanges method on the underlying context</returns> public int SaveChanges(bool index = true) { int result = 0; if (contextInterface.ChangeTracker.HasChanges()) { // get the Lucene Changeset from the current ChangeTracker LuceneIndexChangeset changes = GetChangeset(); // Call the base AFTER we have collected out changeset result = contextInterface.SaveChanges(); // finally, update our lucene with the changes if there are any if (changes.HasChanges && index == true) { indexer.Update(changes); } } return(result); }