public void Write(RelationalEvent evt)
        {
            lock (_syncRoot) {
                if (_schema == null)
                {
                    _schema = new SortedList <string, RelationalField>();
                    foreach (var s in evt.Schema)
                    {
                        _schema.Add(s.ColumnName, s);
                    }
                }
                else
                {
                    // Check to see if anything has changed...
                    foreach (var s in evt.Schema)
                    {
                        if (_schema.ContainsKey(s.ColumnName))
                        {
                            if (_schema[s.ColumnName].Type != s.Type)
                            {
                                // There is a change in type, always expand to
                                _schema[s.ColumnName].Type = DbType.Varchar;
                            }
                        }
                        else
                        {
                            // There is a new field
                            _schema.Add(s.ColumnName, s);
                        }
                    }
                }

                // Its a new time block, so dispose of all the active files
                if (_lastTimeString == null || _lastTimeString != GetCurrentTimeString())
                {
                    var keys = _schemaFiles.Keys.ToList();

                    foreach (var k in keys)
                    {
                        _schemaFiles[k].Dispose();
                        _schemaFiles.Remove(k);
                    }

                    _lastTimeString = GetCurrentTimeString();
                }

                var schemaHash = RelationalEventFile.GetSchemaHash(_schema);

                if (!_schemaFiles.ContainsKey(schemaHash))
                {
                    _schemaFiles[schemaHash] = new RelationalEventFile(_basePath, GetCurrentTimeString(), _eventName, _schema);
                }

                _schemaFiles[schemaHash].WriteRow(evt);
            }
        }
        public void Write(RelationalEvent evt)
        {
            lock (_syncRoot) {
                if (_schema == null) {
                    _schema = new SortedList<string, RelationalField>();
                    foreach (var s in evt.Schema) {
                        _schema.Add(s.ColumnName, s);
                    }

                } else {
                    // Check to see if anything has changed...
                    foreach (var s in evt.Schema) {
                        if (_schema.ContainsKey(s.ColumnName)) {
                            if (_schema[s.ColumnName].Type != s.Type) {
                                // There is a change in type, always expand to
                                _schema[s.ColumnName].Type = DbType.Varchar;
                            }
                        } else {
                            // There is a new field
                            _schema.Add(s.ColumnName, s);
                        }
                    }
                }

                // Its a new time block, so dispose of all the active files
                if (_lastTimeString == null || _lastTimeString != GetCurrentTimeString()) {
                    var keys = _schemaFiles.Keys.ToList();

                    foreach (var k in keys) {
                        _schemaFiles[k].Dispose();
                        _schemaFiles.Remove(k);
                    }

                    _lastTimeString = GetCurrentTimeString();
                }

                var schemaHash = RelationalEventFile.GetSchemaHash(_schema);

                if (!_schemaFiles.ContainsKey(schemaHash)) {
                    _schemaFiles[schemaHash] = new RelationalEventFile(_basePath, GetCurrentTimeString(), _eventName, _schema);
                }

                _schemaFiles[schemaHash].WriteRow(evt);
            }
        }