Esempio n. 1
0
        private ITableDefinition GetTableDefinition(string schemaFile)
        {
            var tableDefinition = XmlSchemaFactory.CreateInstance(_dbContext).GetTableDefinition(schemaFile);

            SetCollationIfUseCollationParameterUsed(tableDefinition);
            return(tableDefinition);
        }
Esempio n. 2
0
        private IXmlSchema SetupXmlSchemaAndTable(bool setU4Indexes = true)
        {
            var xmlSchema = XmlSchemaFactory.CreateInstance(DbContext);

            if (setU4Indexes)
            {
                var u4Indexes = U4IndexesFactory.CreateInstance(DbContext);
                u4Indexes.AagTableName  = Aagindex;
                u4Indexes.AsysTableName = Asysindex;
                xmlSchema.U4Indexes     = u4Indexes;
            }
            xmlSchema.XmlWriter = AXmlFactory.CreateWriter();
            TestTableCreator.CreateTestTableWithIndex(DbContext, TestTable);
            TestTableCreator.CreateIndexTables(DbContext, Asysindex, Aagindex);
            return(xmlSchema);
        }
Esempio n. 3
0
        public bool WriteTable(string tableName)
        {
            try
            {
                Stopwatch stopWatch = new Stopwatch();
                stopWatch.Start();

                _logger.Write($"{tableName,30} Started...");

                var xmlSchema = XmlSchemaFactory.CreateInstance(_dbContext);
                if (UseU4Indexes)
                {
                    xmlSchema.U4Indexes = U4IndexesFactory.CreateInstance(_dbContext);
                }
                ITableDefinition tableDefinition = xmlSchema.Write(Directory, tableName, SchemaFileSuffix);

                if (tableDefinition.HasBlobColumn)
                {
                    System.IO.Directory.CreateDirectory($@"{Directory}{tableDefinition.Name}");
                }

                long rowCounter = WriteTableDataToDataFile(tableDefinition, DataFileSuffix);

                stopWatch.Stop();

                string message = $"{tableDefinition.Name,30} {rowCounter,10} rows copied. Time: {stopWatch.Elapsed}";
                _logger.Write(message);
            }
            catch (Exception ex)
            {
                _logger.Write($"ERROR with table {tableName}");
                _logger.Write(ex);
                return(false);
            }

            return(true);
        }