/// <summary> /// Выполнить преобразование структуры папок в разработку типовых маршрутов для импорта. /// </summary> private void HandleImportRoute() { foreach (var routeHandlerType in this.routeHandlers) { IRecordHandler routeHandler = routeHandlerType.Value; string filePath = Path.Combine(Path.GetDirectoryName(this.PackageFileName), routeHandlerType.Key); var rootModel = new RootModel(); routeHandler.HandleImport(rootModel, this.importFilter); using (var fileStream = new FileStream(filePath, FileMode.Create)) { var recordsSerializer = new XmlSerializer(typeof(RootModel)); using (var writer = XmlWriter.Create(fileStream, GetXmlWriterSettings())) { try { Log.Info(" Запись пакета разработки ТМ: запущена."); recordsSerializer.Serialize(writer, rootModel, GetXmlSerializerNamespaces()); Log.Info(" Запись пакета разработки ТМ: завершена."); } catch (Exception ex) { Log.Error(" Запись пакета разработки ТМ: ошибка.", ex); throw; } } } } }
/// <summary> /// Выполнить преобразование разработки типовых маршрутов в структуру папок. /// </summary> private void HandleExportRoute(XmlReaderSettings packageReaderSettings) { foreach (var routeHandlerType in this.routeHandlers) { IRecordHandler routeHandler = routeHandlerType.Value; string filePath = Path.Combine(Path.GetDirectoryName(this.PackageFileName), routeHandlerType.Key); if (File.Exists(filePath)) { using (var fileStream = File.OpenRead(filePath)) { var recordsSerializer = new XmlSerializer(typeof(RootModel)); using (var reader = XmlReader.Create(fileStream, packageReaderSettings)) { RootModel rootModel = null; try { Log.Info(" Чтение пакета ТМ: запущено."); rootModel = (RootModel)recordsSerializer.Deserialize(reader); Log.Info(" Чтение пакета ТМ: завершено."); } catch (Exception ex) { Log.Error(" Чтение пакета ТМ: ошибка. " + ex.Message, ex); throw; } var settings = GetXmlWriterSettings(); var namespaces = GetXmlSerializerNamespaces(); routeHandler.HandleExport(rootModel, settings, namespaces); if (this.CommandLineOptions.AuthType == AuthenticationType.Windows) { Log.Warn(" Обработка удаления типовых маршрутов не будет выполнена, так как используется Windows-аутентификация."); continue; } if (string.IsNullOrEmpty(this.CommandLineOptions.Server) || string.IsNullOrEmpty(this.CommandLineOptions.Database) || string.IsNullOrEmpty(this.CommandLineOptions.UserName)) { Log.Warn(" Обработка удаления типовых маршрутов не будет выполнена, так как не заданы параметры подключения к БД."); continue; } var connectionParams = new ConnectionParams( this.CommandLineOptions.Server, this.CommandLineOptions.Database, this.CommandLineOptions.UserName, this.CommandLineOptions.Password); routeHandler.HandleDelete(connectionParams); } } } } }
public N4pperManager( N4pperOptions options, IQueryProfiler profiler, IQueryParamentersMangler paramMangler, IRecordHandler recordHandler, OMnG.ObjectExtensionsConfiguration objExtConf, OMnG.TypeExtensionsConfiguration typeExtConf) { Options = options ?? new N4pperOptions(); Profiler = profiler; ParamentersMangler = paramMangler ?? new DefaultParameterMangler(); RecordHandler = recordHandler ?? new DefaultRecordHanlder(); ObjectExtensionsConfiguration = objExtConf ?? new N4pper.ObjectExtensionsConfiguration(); TypeExtensionsConfiguration = typeExtConf ?? new N4pper.TypeExtensionsConfiguration(); }
internal ObjectBTreeFileEnumerator(ObjectBTreeFile File, IRecordHandler RecordHandler, IObjectSerializer DefaultSerializer) { this.file = File; this.currentBlockIndex = 0; this.currentBlock = null; this.currentReader = null; this.currentHeader = null; this.blockUpdateCounter = File.BlockUpdateCounter; this.locked = false; this.recordHandler = RecordHandler; this.startingPoint = null; this.defaultSerializer = DefaultSerializer; this.timeoutMilliseconds = this.file.TimeoutMilliseconds; this.Reset(); if (this.defaultSerializer == null && typeof(T) != typeof(object)) { this.defaultSerializer = this.file.Provider.GetObjectSerializer(typeof(T)); } }
internal ObjectBTreeFileEnumerator(ObjectBTreeFile File, IRecordHandler RecordHandler) : this(File, RecordHandler, null) { }
public void AddHandler(IRecordHandler handler) { handlers.Add(handler); }
internal ObjectBTreeFileEnumerator(ObjectBTreeFile File, bool Locked, IRecordHandler RecordHandler, BlockInfo StartingPoint) : this(File, Locked, RecordHandler, StartingPoint, null) { }