Skip to content

Commit 60d3719

Browse files
Merge pull request #29 from Lempireqc/master
Add CleanEffort
2 parents 055e32b + d2c5a06 commit 60d3719

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Main/Source/NMemory.Shared/Indexes/IIndex.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface IIndex
3636

3737
long Count { get; }
3838

39-
////void Clear();
39+
void Clear();
4040

4141
void Rebuild();
4242
}

Main/Source/NMemory.Shared/Indexes/IndexBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,10 @@ public void Rebuild()
198198
this.DataStructure.Insert(this.KeyInfo.SelectKey(entity), entity);
199199
}
200200
}
201+
202+
public void Clear()
203+
{
204+
this.DataStructure.Clear();
205+
}
201206
}
202207
}

Main/Source/NMemory.Shared/Tables/Table`2.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public abstract class Table<TEntity, TPrimaryKey> :
6363

6464
#region Fields
6565

66-
private readonly IdentityField<TEntity> identityField;
66+
private IdentityField<TEntity> identityField;
67+
private readonly IdentitySpecification<TEntity> originalIdentitySpecification;
6768
private readonly IUniqueIndex<TEntity, TPrimaryKey> primaryKeyIndex;
6869
private readonly IList<IIndex<TEntity>> indexes;
6970
private readonly IEntityService entityService;
@@ -109,6 +110,7 @@ public Table(
109110
if (identitySpecification != null)
110111
{
111112
this.identityField = new IdentityField<TEntity>(identitySpecification);
113+
this.originalIdentitySpecification = identitySpecification;
112114
}
113115
}
114116

@@ -806,5 +808,10 @@ private void RegisterTimestampConstraints()
806808
this.Contraints.Add(new TimestampConstraint<TEntity>(lambda));
807809
}
808810
}
811+
812+
public void RestoreIdentityField()
813+
{
814+
identityField = new IdentityField<TEntity>(this.originalIdentitySpecification);
815+
}
809816
}
810817
}

0 commit comments

Comments
 (0)