Beispiel #1
0
 public DbUpgradeEventArgs(Database database, DbUpgradeEventType eventType, DbUpgradeInfo upgradeInfo, Exception exception = null, DbUpgradeScript failedScript = null)
 {
     Database     = database;
     EventType    = eventType;
     UpgradeInfo  = upgradeInfo;
     Exception    = exception;
     FailedScript = failedScript;
 }
Beispiel #2
0
 public DbUpgradeEventArgs(DataSource dataSource, DataSourceEventType eventType, List <DbUpgradeScript> scripts,
                           DateTime startedOn, DateTime?completedOn,
                           Exception exception = null, DbUpgradeScript failedScript = null)
 {
     DataSource   = dataSource;
     Scripts      = scripts;
     StartedOn    = startedOn;
     CompletedOn  = completedOn;
     Exception    = exception;
     FailedScript = failedScript;
 }
Beispiel #3
0
        public static IDbUpgradeScript NewDbModelChangeScript(this IDbUpgradeBatch batch, DbUpgradeScript script, int index = 0, Exception exception = null)
        {
            var session = EntityHelper.GetSession(batch);
            var ent     = session.NewEntity <IDbUpgradeScript>();

            ent.Batch = batch;
            if (script.Migration != null)
            {
                ent.ObjectType     = DbObjectType.Other;
                ent.FullObjectName = script.Migration.Name;
            }
            else if (script.ModelChange != null)
            {
                ent.ObjectType     = script.ModelChange.ObjectType;
                ent.FullObjectName = script.ModelChange.DbObject.GlobalName;
            }
            else
            {
                ent.ObjectType     = DbObjectType.Other;
                ent.FullObjectName = "(Unknown)";
            }
            ent.ExecutionOrder = index;
            ent.Sql            = script.Sql;
            ent.Duration       = script.Duration;
            if (exception != null)
            {
                ent.Errors = exception.ToLogString();
            }
            return(ent);
        }