Beispiel #1
0
 public void LogDbUpgrade(DbUpgradeReport report)
 {
     lock(_lock) {
     _pendingBatches.Add(report);
       }
       Flush();
 }
Beispiel #2
0
        private void OnUpgraded(List <DbUpgradeScript> appliedScripts, Exception exception = null, DbUpgradeScript failedScript = null)
        {
            DbUpgradeEventType eventType = exception == null ? DbUpgradeEventType.DbModelUpgraded : DbUpgradeEventType.Error;
            var args = new DbUpgradeEventArgs(_database, eventType, _upgradeInfo, exception, failedScript);

            _app.DataSourceEvents.OnDbUpgraded(args);
            var logService = (IDbUpgradeLogService)_app.GetService(typeof(IDbUpgradeLogService));

            if (logService != null)
            {
                var oldVersionInfo = _upgradeInfo.OldDbModel.VersionInfo;
                var oldVersion     = oldVersionInfo == null ? DbVersionInfo.ZeroVersion : oldVersionInfo.Version;
                var report         = new DbUpgradeReport()
                {
                    Version     = _database.DbModel.VersionInfo.Version, OldDbVersion = oldVersion,
                    MachineName = "(Unknown)",// Environment.MachineName,
                    UserName    = "******",
                    Scripts     = appliedScripts, StartedOn = _upgradeInfo.StartedOn, CompletedOn = _upgradeInfo.EndedOn, Exception = exception, FailedScript = failedScript
                };
                logService.LogDbUpgrade(report);
            }
        }
Beispiel #3
0
        private void OnUpgraded(List <DbUpgradeScript> appliedScripts,
                                DateTime startedOn, DateTime completedOn,
                                Exception exception = null, DbUpgradeScript failedScript = null)
        {
            var args = new DbUpgradeEventArgs(_dataSource, DataSourceEventType.DbModelUpdated, appliedScripts,
                                              startedOn, completedOn, exception, failedScript);

            _dataAccess.Events.OnDbUpgraded(args);
            var logService = _app.GetService <IDbUpgradeLogService>();

            if (logService != null)
            {
                var oldVersionInfo = _upgradeInfo.OldDbModel.VersionInfo;
                var oldVersion     = oldVersionInfo == null ? DbVersionInfo.ZeroVersion : oldVersionInfo.Version;
                var batch          = new DbUpgradeReport()
                {
                    Version     = _database.DbModel.VersionInfo.Version, OldDbVersion = oldVersion,
                    MachineName = Environment.MachineName, UserName = Environment.UserName,
                    Scripts     = appliedScripts, StartedOn = startedOn, CompletedOn = completedOn, Exception = exception, FailedScript = failedScript
                };
                logService.LogDbUpgrade(batch);
            }
        }
Beispiel #4
0
 private void OnUpgraded(List<DbUpgradeScript> appliedScripts, 
     DateTime startedOn, DateTime completedOn,
     Exception exception = null, DbUpgradeScript failedScript = null)
 {
     var args = new DbUpgradeEventArgs(_dataSource, DataSourceEventType.DbModelUpdated, appliedScripts,
                                     startedOn, completedOn, exception, failedScript);
       _dataAccess.Events.OnDbUpgraded(args);
       var logService = _app.GetService<IDbUpgradeLogService>();
       if(logService != null) {
     var oldVersionInfo = _upgradeInfo.OldDbModel.VersionInfo;
     var oldVersion = oldVersionInfo == null ? DbVersionInfo.ZeroVersion : oldVersionInfo.Version;
     var batch = new DbUpgradeReport() { Version = _database.DbModel.VersionInfo.Version, OldDbVersion = oldVersion,
       MachineName = Environment.MachineName,  UserName = Environment.UserName,
       Scripts = appliedScripts, StartedOn = startedOn, CompletedOn = completedOn, Exception = exception, FailedScript = failedScript };
     logService.LogDbUpgrade(batch);
       }
 }