public StructuredDataStorage() { var config = Catalog.Factory.Resolve <IConfig>(SpecialFactoryContexts.Routed); _store = config.Get <IPersistentStore <TKey> >(StructuredDataStorageLocalConfig.Store); _comparer = config.Get <IComparer <TKey> >(StructuredDataStorageLocalConfig.Comparer); _cloner = config.Get <Func <TKey, TKey> >(StructuredDataStorageLocalConfig.Cloner); _store.Write(log => { if (0 == log.Length) { WriteHeader(log); log.Flush(); } Validate(log); while (true) { var lastPos = log.Position; if (log.Position == log.Length) { break; } var commands = ReadCommands(log, lastPos); if (null == commands) { break; } if (commands.Length == 1 && commands[0].Code == CommandCode.Skip) { log.Position += commands[0].Size; continue; } var commandGroups = commands.GroupBy(c => c.TableId); foreach (var c in commandGroups) { _tables[c.Key].ApplyCommands(c); } } }); }