/// <summary>
        /// Loads the data.
        /// </summary>
        public override void LoadData()
        {
            try
            {
                using (var session = DataProvider.SessionFactory.OpenSession())
                {
                    // Add a new registry if it's not loaded yet.
                    if (!session.Query <HospitalRegistry>().Any())
                    {
                        decimal          version  = 1;
                        HospitalRegistry registry = new HospitalRegistry(version)
                        {
                            Name = GetType().Assembly.GetCustomAttribute <AssemblyDescriptionAttribute>().Description
                        };
                        session.SaveOrUpdate(registry);
                    }

                    // Called because this wasn't in the schema version table yet, so add it so we don't check again.
                    var sversion = VersionStrategy.GetVersion(session);

                    session.SaveOrUpdate(sversion);
                    session.Flush();
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error loading Hospital Registry data");
            }
        }
示例#2
0
        public void VersionStrategy_Should_ImplementICommandOfObjectModel()
        {
            // Arrange
            var reflectionMock = new Mock <IReflection>();

            // Act
            var objectUnderTest = new VersionStrategy(reflectionMock.Object);

            // Assert
            Assert.IsInstanceOf <ICommand <ObjectModel> >(objectUnderTest);
        }
示例#3
0
        public void VersionStrategy_Should_ReturnEmptyHelpText()
        {
            // Arrange
            var reflectionMock = new Mock <IReflection>();
            var newStrategy    = new VersionStrategy(reflectionMock.Object);

            // Act
            var helpText = newStrategy.GetHelpText();

            // Assert
            Assert.AreEqual(helpText, Resources.text.help.HelpTextValues.VersionCommand);
        }
示例#4
0
        public void VersionStrategy_Should_ReturnCommandName()
        {
            // Arrange
            var reflectionMock = new Mock <IReflection>();
            var newStrategy    = new VersionStrategy(reflectionMock.Object);

            // Act
            var commandName = newStrategy.Name;

            // Assert
            Assert.AreEqual(commandName, Constants.CommandName.Version);
        }
示例#5
0
        public void VersionStrategy_GetNextVersion_OldResourceNull_ExpectVersion1()
        {
            //------------Setup for test--------------------------
            var versionStrategy = new VersionStrategy();

            //------------Execute Test---------------------------
            var output = versionStrategy.GetNextVersion(new Mock <IResource>().Object, null, "bob", "save");


            //------------Assert Results-------------------------
            Assert.AreEqual(output.VersionNumber, "1");
            Assert.AreEqual(output.Reason, "save");
            Assert.AreEqual(output.User, "bob");
            Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today);
        }
示例#6
0
 static Version Bump(Version version, VersionStrategy strategy)
 {
     switch (strategy)
     {
         case VersionStrategy.BugFix:
             return BumpBugFix(version);
         case VersionStrategy.MinorFeature:
             return BumpMinorFeature(version);
         case VersionStrategy.FullRelease:
             return BumpFullRelease(version);
         case VersionStrategy.MajorMilestone:
             return BumpMajorMilestone(version);
     }
     return version;
 }
示例#7
0
        public void VersionStrategy_GetCurrentVersion_OldResourceNull_GetVersion1()
        {
            //------------Setup for test--------------------------
            var versionStrategy = new VersionStrategy();


            //------------Execute Test---------------------------
            var output = versionStrategy.GetCurrentVersion(null, new VersionInfo(DateTime.Now, "bob", "dave", "1", Guid.Empty, Guid.Empty), "bob", "save");


            //------------Assert Results-------------------------
            Assert.AreEqual(output.VersionNumber, "2");
            Assert.AreEqual(output.Reason, "save");
            Assert.AreEqual(output.User, "bob");
            Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today);
        }
示例#8
0
文件: Program.cs 项目: rafntor/bdhero
        static Version Bump(Version version, VersionStrategy strategy)
        {
            switch (strategy)
            {
            case VersionStrategy.BugFix:
                return(BumpBugFix(version));

            case VersionStrategy.MinorFeature:
                return(BumpMinorFeature(version));

            case VersionStrategy.FullRelease:
                return(BumpFullRelease(version));

            case VersionStrategy.MajorMilestone:
                return(BumpMajorMilestone(version));
            }
            return(version);
        }
        /// <summary>
        /// Loads the data.
        /// </summary>
        public override void LoadData()
        {
            try
            {
                if (Directory.Exists(baseDataDir))
                {
                    var files = Directory.GetFiles(baseDataDir, "Menu*.sql");
                    foreach (var file in files)
                    {
                        try
                        {
                            VersionStrategy.Filename = file;
                            // Appending Menus
                            if (!VersionStrategy.IsLoaded())
                            {
                                // Verify data file exists.
                                if (!File.Exists(Path.Combine(baseDataDir, file)))
                                {
                                    Logger.Warning(
                                        "Import file \"{0}\" missing from the base data resources directory.",
                                        file);
                                    return;
                                }

                                using (var session = DataProvider.SessionFactory.OpenSession())
                                {
                                    session.CreateSQLQuery(ReadFileContent(Path.Combine(baseDataDir, file)))
                                    .ExecuteUpdate();
                                    session.SaveOrUpdate(VersionStrategy.Version);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Logger.Write(e, "Error loading menu data from file {0}", file);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error loading menu data");
            }
        }
示例#10
0
        public void VersionStrategy_GetNextVersion_OldResourceNull_Expectincremented()
        {
            //------------Setup for test--------------------------
            var versionStrategy = new VersionStrategy();

            var oldResource = new Mock <IResource>();
            var id          = Guid.NewGuid();
            var ver         = Guid.NewGuid();

            oldResource.Setup(a => a.VersionInfo).Returns(new VersionInfo(DateTime.Now, "mook", "usr", "1", id, ver));
            //------------Execute Test---------------------------
            var output = versionStrategy.GetNextVersion(new Mock <IResource>().Object, oldResource.Object, "bob", "save");


            //------------Assert Results-------------------------
            Assert.AreEqual(output.VersionNumber, "2");
            Assert.AreEqual(output.Reason, "save");
            Assert.AreEqual(output.User, "bob");
            Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today);
        }
示例#11
0
        public void VersionStrategy_Should_PrintVersionInformation([ValueSource(nameof(Inputs))] string[] inputParams, [ValueSource(nameof(AssemblyInfos))] AssemblyInfo[] assemblyInfos)
        {
            // Arrange
            var reflectionMock = new Mock <IReflection>();

            reflectionMock.Setup(x => x.GetAppioAssemblyInfos()).Returns(assemblyInfos);
            var objectUnderTest    = new VersionStrategy(reflectionMock.Object);
            var loggerListenerMock = new Mock <ILoggerListener>();

            loggerListenerMock.Setup(x => x.Info(LoggingText.VersionCommandCalled));
            AppioLogger.RegisterListener(loggerListenerMock.Object);

            // Act
            var result = objectUnderTest.Execute(inputParams);

            // Assert
            var versionRegex = new Regex(@"^\d+.\d+.\d+$");

            Assert.IsTrue(result.Success);
            Assert.IsNotNull(result.OutputMessages);
            Assert.IsTrue(result.OutputMessages.All(v => versionRegex.IsMatch(v.Value)));
            loggerListenerMock.Verify(x => x.Info(LoggingText.VersionCommandCalled), Times.Once);
            AppioLogger.RemoveListener(loggerListenerMock.Object);
        }
        /// <summary>
        /// Loads the data.
        /// </summary>
        public override void LoadData()
        {
            try
            {
                if (!VersionStrategy.IsLoaded() && VersionStrategy.IsNewest())
                {
                    Logger.Information($"Processing base data update for type {typeof(TEntity).Name}");

                    var rows = 0;
                    // start transaction
                    using (var session = DataProvider.SessionFactory.OpenStatelessSession())
                    {
                        // Always turncate for enum types
                        using (var cmd = session.Connection.CreateCommand())
                        {
                            if (cmd.Connection.State == ConnectionState.Closed)
                            {
                                cmd.Connection.Open();
                            }
                            cmd.CommandTimeout = 900;
                            cmd.CommandText    = string.Format("TRUNCATE TABLE {0}", tableName);
                            cmd.ExecuteNonQuery();
                        }

                        // Loop through values in the enum.
                        using (var bulkImporter = new BulkInsert <TEntity, TKey>(session.Connection))
                        {
                            bulkImporter.ConnectionRequested += (o, e) =>
                            {
                                e.Data = session.Connection as SqlConnection;
                            };
                            bulkImporter.Prepare();
                            bulkImporter.BatchSize = 1000;

                            Array values = Enum.GetValues(typeof(TEnum));
                            foreach (var val in values)
                            {
                                var temp = GetEntity(val);
                                if (temp != null)
                                {
                                    bulkImporter.Insert(temp);
                                    rows++;
                                }
                            }
                        }
                    }

                    SchemaVersion version;
                    using (var session = DataProvider.SessionFactory.OpenSession())
                    {
                        version = VersionStrategy.GetVersion(session);
                        session.SaveOrUpdate(version);
                        session.Flush();
                    }

                    Logger.Information($"Base data update completed for type {typeof(TEntity).Name}: {rows} rows inserted or updated; now at schema version {version}");
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error importing {0} enumeration values for data type {1}", typeof(TEnum).Name,
                             typeof(TEntity).Name);
            }
        }
示例#13
0
        /// <summary>
        /// Checkin di un documento in stato checkout
        /// </summary>
        /// <param name="checkOutStatus"></param>
        /// <param name="library"></param>
        /// <returns></returns>
        public bool CheckIn(DocsPaVO.CheckInOut.CheckOutStatus checkOutStatus, byte[] content, string checkInComments)
        {
            bool retValue = false;

            try
            {
                // Creazione di un nuovo DataObject che rappresenta il documento da sbloccare
                DataObject dataObject = new DataObject();
                dataObject.Type = ObjectTypes.DOCUMENTO;

                // Reperimento identity del documento da sbloccare
                if (DocsPaQueryHelper.isStampaRegistro(checkOutStatus.DocumentNumber))
                {
                    dataObject.Identity = Dfs4DocsPa.getDocumentoStampaRegistroIdentityByDocNumber(checkOutStatus.DocumentNumber);
                }
                else
                {
                    dataObject.Identity = Dfs4DocsPa.getDocumentoIdentityByDocNumber(checkOutStatus.DocumentNumber);
                }

                List <Property> propertyList = new List <Property>();

                // Impostazione numero versione
                propertyList.Add(new NumberProperty(TypeDocumento.NUMERO_VERSIONE, DocsPaQueryHelper.getDocumentNextVersionId(checkOutStatus.IDDocument)));

                // Rimozione valore proprietà p3_locked_filepath
                propertyList.Add(new StringProperty(TypeDocumento.CHECKOUT_LOCAL_FILE_PATH, string.Empty));

                // Rimozione valore proprietà p3_locked_file_machinename
                propertyList.Add(new StringProperty(TypeDocumento.CHECKOUT_MACHINE_NAME, string.Empty));

                dataObject.Properties = new PropertySet();
                dataObject.Properties.Properties.AddRange(propertyList);

                // Temporaneo, inserimento contentuto file
                OperationOptions opts = new OperationOptions();

                CheckinProfile checkInProfile = new CheckinProfile();
                checkInProfile.MakeCurrent         = true;
                checkInProfile.DeleteLocalFileHint = true;

                opts.Profiles.Add(checkInProfile);

                // Creazione di un nuovo oggetto BinaryContent
                BinaryContent binaryContent = new BinaryContent();
                binaryContent.Value = content;

                string ext = System.IO.Path.GetExtension(checkOutStatus.DocumentLocation);
                if (ext.StartsWith("."))
                {
                    ext = ext.Substring(1);
                }
                string fileFormat = DfsHelper.getDctmFileFormat(this.GetServiceInstance <IQueryService>(false), ext);

                binaryContent.Format = fileFormat;

                dataObject.Contents.Add(binaryContent);

                DataPackage dataPackage = new DataPackage(dataObject);
                dataPackage.RepositoryName = DctmConfigurations.GetRepositoryName();

                IVersionControlService service = this.GetServiceInstance <IVersionControlService>(false);

                VersionStrategy strategy = VersionStrategy.IMPLIED;
                if (!DocsPaQueryHelper.isDocumentAcquisito(checkOutStatus.IDDocument))
                {
                    strategy = VersionStrategy.SAME_VERSION;
                }

                dataPackage = service.Checkin(dataPackage, strategy, false, null, opts);

                retValue = (dataPackage.DataObjects.Count > 0);

                if (retValue)
                {
                    logger.Debug(string.Format("Documentum.CheckIn: effettuato il checkin del documento con id {0} e docnumber {1}", checkOutStatus.IDDocument, checkOutStatus.DocumentNumber));
                }
            }
            catch (Exception ex)
            {
                retValue = false;

                logger.Debug("Errore in Documentum.CheckIn: " + ex.ToString());
            }

            return(retValue);
        }
        /// <summary>
        /// Loads the data.
        /// </summary>
        public override void LoadData()
        {
            try
            {
                // Get list of files matching mask
                // TODO: Throw an error if the path doesn't exist?
                if (Directory.Exists(baseDataDir))
                {
                    var files = Directory.GetFiles(baseDataDir, "MeasureTopics*.csv");
                    foreach (var file in files)
                    {
                        try
                        {
                            VersionStrategy.Filename = file;
                            // Appending measures to the topics tables, not replacing with the newest file.
                            if (!VersionStrategy.IsLoaded())
                            {
                                // Verify data file exists.
                                if (!File.Exists(Path.Combine(baseDataDir, file)))
                                {
                                    Logger.Warning(
                                        "Import file \"{0}\" missing from the base data resources directory.",
                                        file);
                                    return;
                                }

                                using (var session = DataProvider.SessionFactory.OpenSession())
                                {
                                    using (var trans = session.BeginTransaction())
                                    {
                                        var builder = new OleDbConnectionStringBuilder()
                                        {
                                            Provider   = "Microsoft.ACE.OLEDB.12.0",
                                            DataSource = baseDataDir,
                                        };

                                        builder["Extended Properties"] = "text;HDR=YES;FMT=Delimited";

                                        using (var conn = new OleDbConnection(builder.ConnectionString))
                                        {
                                            conn.Open();
                                            var sql = string.Format("SELECT * FROM [{0}]", Path.GetFileName(file));

                                            using (var cmd = new OleDbCommand(sql, conn))
                                            {
                                                // NOTE: Not using the bulk importer here because we have two types of data being imported at the same time.
                                                var reader = cmd.ExecuteReader();
                                                while (reader != null && reader.Read())
                                                {
                                                    var parentName        = reader.Guard <string>("ParentName") ?? "";
                                                    var name              = reader.Guard <string>("Name") ?? "";
                                                    var longTitle         = reader.Guard <string>("Longtitle") ?? "";
                                                    var description       = reader.Guard <string>("description") ?? "";
                                                    var consumerLongTitle = reader.Guard <string>("ConsumerLongTitle") ??
                                                                            "";
                                                    var consumerDescription =
                                                        reader.Guard <string>("ConsumerDescription") ?? "";
                                                    var categoryType = reader.Guard <string>("CategoryType");

                                                    var topicFacts1Text     = reader.Guard <string>("TopicFact1Text") ?? "";
                                                    var topicFacts1Citation =
                                                        reader.Guard <string>("TopicFact1Citation") ?? "";
                                                    var topicFacts1Image    = reader.Guard <string>("TopicFact1Image") ?? "";
                                                    var topicFacts2Text     = reader.Guard <string>("TopicFact2Text") ?? "";
                                                    var topicFacts2Citation =
                                                        reader.Guard <string>("TopicFact2Citation") ?? "";
                                                    var topicFacts2Image    = reader.Guard <string>("TopicFact2Image") ?? "";
                                                    var topicFacts3Text     = reader.Guard <string>("TopicFact3Text") ?? "";
                                                    var topicFacts3Citation =
                                                        reader.Guard <string>("TopicFact3Citation") ?? "";
                                                    var topicFacts3Image = reader.Guard <string>("TopicFact3Image") ?? "";

                                                    var tipsChecklist = reader.Guard <string>("TipsChecklist") ?? "";
                                                    var topicIcon     = reader.Guard <string>("TopicIcon") ?? "";


                                                    if (!parentName.Equals("SKIP_ROW"))
                                                    {
                                                        AddOrUpdateToDB(
                                                            session, parentName, name, longTitle, description,
                                                            consumerLongTitle, consumerDescription, categoryType,
                                                            topicFacts1Text, topicFacts1Citation, topicFacts1Image,
                                                            topicFacts2Text, topicFacts2Citation, topicFacts2Image,
                                                            topicFacts3Text, topicFacts3Citation, topicFacts3Image,
                                                            tipsChecklist, topicIcon);
                                                    }
                                                }
                                            }
                                        }
                                        trans.Commit();
                                    }
                                }

                                using (var session = DataProvider.SessionFactory.OpenSession())
                                {
                                    var version = VersionStrategy.GetVersion(session);

                                    session.SaveOrUpdate(version);
                                    session.Flush();
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Logger.Write(e, "Error loading measure topic data from file {0}", file);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error loading measure topics data");
            }
        }
示例#15
0
        /// <summary>
        /// Loads the data.
        /// </summary>
        public override void LoadData()
        {
            try
            {
                var tableIndexIsOff = false;

                // Get list of files matching mask
                // TODO: Throw an error if the path doesn't exist?
                if (Directory.Exists(baseDataDir))
                {
                    var files = Directory.GetFiles(baseDataDir, Fileprefix + "-*.csv");
                    PreProcessFile(ref files);
                    foreach (var file in files)
                    {
                        VersionStrategy.Filename = file;
                        if (!VersionStrategy.IsLoaded() &&
                            (ImportType == BaseDataImportStrategyType.Append || VersionStrategy.IsNewest()))
                        {
                            // start transaction
                            Logger.Write($"Processing base data update for type {typeof(TEntity).Name} from file {file}");
                            var rows = 0;

                            // Verify data file exists.
                            if (!File.Exists(Path.Combine(baseDataDir, file)))
                            {
                                Logger.Warning("Import file \"{0}\" missing from the base data resources directory.", file);
                                return;
                            }

                            using (var session = DataProvider.SessionFactory.OpenStatelessSession())
                            {
                                // Turn off indexes.
                                if (TurnOffIndexesDuringImpport && !tableIndexIsOff)
                                {
                                    DisableTableIndexes();
                                    tableIndexIsOff = true;
                                }

                                // Turncate the table if it's a replace strategy
                                if (ImportType == BaseDataImportStrategyType.Replace)
                                {
                                    using (var cmd = session.Connection.CreateCommand())
                                    {
                                        if (cmd.Connection.State == ConnectionState.Closed)
                                        {
                                            cmd.Connection.Open();
                                        }
                                        cmd.CommandTimeout = 900;
                                        cmd.CommandText    = string.Format("TRUNCATE TABLE {0}", tableName);
                                        cmd.ExecuteNonQuery();
                                    }
                                }

                                var builder = new OleDbConnectionStringBuilder();
                                builder.Provider               = "Microsoft.ACE.OLEDB.12.0";
                                builder.DataSource             = baseDataDir;
                                builder["Extended Properties"] = "text;HDR=YES;FMT=Delimited";

                                using (var conn = new OleDbConnection(builder.ConnectionString))
                                {
                                    conn.Open();
                                    var sql = string.Format("SELECT * FROM [{0}]", Path.GetFileName(file));
                                    using (var cmd = new OleDbCommand(sql, conn))
                                    {
                                        var reader = cmd.ExecuteReader();
                                        using (var bulkImporter = new BulkInsert <TEntity, TKey>(session.Connection))
                                        {
                                            bulkImporter.ConnectionRequested += (o, e) => e.Data = session.Connection as SqlConnection;
                                            bulkImporter.Prepare();
                                            bulkImporter.BatchSize = 1000;  // TODO: Parameterize?

                                            if (reader == null)
                                            {
                                                Logger.Warning(
                                                    "A problem occurred while trying to read CSV file \"{0}\". Please make sure that the file is properly formated and has data.",
                                                    file);
                                                return;
                                            }

                                            if (reader.HasRows)
                                            {
                                                while (reader.Read())
                                                {
                                                    var temp = LoadFromReader(reader);
                                                    if (temp != null)
                                                    {
                                                        bulkImporter.Insert(temp);
                                                    }
                                                    rows++;
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            SchemaVersion version;
                            using (var session = DataProvider.SessionFactory.OpenSession())
                            {
                                version = VersionStrategy.GetVersion(session);
                                session.SaveOrUpdate(version);
                                session.Flush();
                            }

                            // commit transaction
                            Logger.Information(
                                $"Base data update completed for type {typeof(TEntity).Name}: {rows} rows inserted or updated; now at schema version {version}");
                        }
                    }

                    if (TurnOffIndexesDuringImpport && tableIndexIsOff)
                    {
                        Task.Factory.StartNew(() => EnableTableIndexes(tableName), TaskCreationOptions.LongRunning);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error loading base data for entity {0}", typeof(TEntity).Name);
            }
        }
示例#16
0
        /// <summary>
        /// Loads the data.
        /// </summary>
        public override void LoadData()
        {
            bool tableIndexIsOff = false;

            try
            {
                // Get list of files matching mask
                // TODO: Throw an error if the path doesn't exist?
                if (Directory.Exists(baseDataDir))
                {
                    var files = Directory.GetFiles(baseDataDir, Fileprefix + "*.csv").ToList();

                    // Turn off indexes.
                    if (files.Any() && TurnOffIndexesDuringImpport && AllowDisableIndexesDuringImport)
                    {
                        DisableTableIndexes();
                        tableIndexIsOff = true;
                    }

                    foreach (var file in files)
                    {
                        VersionStrategy.Filename = file;
                        if (!VersionStrategy.IsLoaded() &&
                            (ImportType == BaseDataImportStrategyType.Append || VersionStrategy.IsNewest()))
                        {
                            Logger.Write($"Processing base data update for type {typeof(TEntity).Name} from file {file}");

                            var rows = 0;
                            // start transaction
                            // Verify format file exists.
                            if (!File.Exists(Path.Combine(baseDataDir, FormatFile)))
                            {
                                Logger.Warning("Format file \"{0}\" missing from the base data resources directory.",
                                               FormatFile);
                                return;
                            }

                            // Verify data file exists.
                            if (!File.Exists(Path.Combine(baseDataDir, file)))
                            {
                                Logger.Warning("Import file \"{0}\" missing from the base data resources directory.",
                                               file);
                                return;
                            }

                            using (var session = DataProvider.SessionFactory.OpenStatelessSession())
                            {
                                // Turn off indexes. // Please do not remove as we may add back. Jason
                                //if (TurnOffIndexesDuringImpport && !tableIndexIsOff)
                                //{
                                //    DisableTableIndexes();
                                //    tableIndexIsOff = true;
                                //}

                                // Turncate the table if it's a replace strategy
                                if (ImportType == BaseDataImportStrategyType.Replace)
                                {
                                    using (var cmd = session.Connection.CreateCommand())
                                    {
                                        if (cmd.Connection.State == ConnectionState.Closed)
                                        {
                                            cmd.Connection.Open();
                                        }
                                        cmd.CommandTimeout = 900;
                                        cmd.CommandText    = string.Format("TRUNCATE TABLE {0}", tableName);
                                        cmd.ExecuteNonQuery();
                                    }
                                }

                                var con = session.Connection;
                                ProvideFeedback(string.Format("Importing file {0}", file));
                                using (var cmd2 = con.CreateCommand())
                                {
                                    cmd2.CommandText = "BULK INSERT " + tableName + " FROM '" +
                                                       Path.Combine(baseDataDir, file) +
                                                       "' WITH (FIRSTROW = 2, FORMATFILE = '" +
                                                       Path.Combine(baseDataDir, FormatFile) + "')";
                                    cmd2.CommandTimeout = 6000;
                                    rows = cmd2.ExecuteNonQuery();
                                }
                            }

                            SchemaVersion version;
                            using (var session = DataProvider.SessionFactory.OpenSession())
                            {
                                // TODO: Add functionality to update existing version row in all scenarios to avoid multiple entries.- Jason
                                version = VersionStrategy.GetVersion(session);
                                session.SaveOrUpdate(version);
                                session.Flush();
                            }

                            Logger.Information(
                                $"Base data update completed for type {typeof(TEntity).Name}: {rows} rows inserted or updated; now at schema version {version}");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex, "Error loading base data for type {0}", typeof(TEntity).Name);
            }
            finally
            {
                if (TurnOffIndexesDuringImpport && AllowEnableIndexesDuringImport && tableIndexIsOff)
                {
                    Task.Factory.StartNew(() => { EnableTableIndexes(tableName); }, TaskCreationOptions.LongRunning);
                }
            }
        }