public override object Execute(object o, System.Collections.IList args) { // get info DbRestoreInfoAttribute info = DbRestoreInfoAttribute.GetInfo(o.GetType()); // create factory IDbFactory factory = info.CreateFactory(); // create admin DbAdministratorBase admin = factory.CreateAdmin(info.ConnectionString, info.DatabaseName); // restore before if before if (this.parent.Schedule == TestSchedule.BeforeTest) { admin.RestoreDatabase(info.BackupDevice, info.BackupDestination); } // do the thing try { return(this.Invoker.Execute(o, args)); } finally { if (this.parent.Schedule == TestSchedule.AfterTest) { admin.RestoreDatabase(info.BackupDevice, info.BackupDestination); } } }