public void GenerateSequence() { lock (syncRoot) { var typeToExistsMap = new Dictionary<string, bool>(); foreach (object item in Session.GetObjectsToSave()) typeToExistsMap[Session.GetClassInfo(item).FullName] = true; if (sequenceGenerator == null) sequenceGenerator = new SequenceGenerator(typeToExistsMap); SubscribeToEvents(); OnSequenceGenerated(sequenceGenerator.GetNextSequence(ClassInfo)); } }
void CancelSequence() { lock (syncRoot) { UnSubscribeFromEvents(); if (sequenceGenerator != null) { sequenceGenerator.Close(); sequenceGenerator = null; } } }