ExecuteCommand() 공개 메소드

public ExecuteCommand ( ) : void
리턴 void
        public override void ExecuteCommand()
        {
            Log.Info(
                "Deleting package registration and all package versions for '{0}'.",
                PackageId);

            using (var sqlConnection = new SqlConnection(ConnectionString.ConnectionString))
            using (var dbExecutor = new SqlExecutor(sqlConnection))
            {
                sqlConnection.Open();

                var packageRegistration = Util.GetPackageRegistration(
                    dbExecutor,
                    PackageId);
                var packages = Util.GetPackages(
                    dbExecutor,
                    packageRegistration.Key);

                foreach(var package in packages)
                {
                    var task = new DeletePackageVersionTask {
                        ConnectionString = ConnectionString,
                        BackupStorage = BackupStorage,
                        StorageAccount = StorageAccount,
                        PackageId = package.Id,
                        PackageVersion = package.Version,
                        Reason = Reason,
                        WhatIf = WhatIf
                    };
                    task.ExecuteCommand();
                }

                Log.Info(
                    "Deleting package registration data for '{0}'",
                    packageRegistration.Id);
                if (!WhatIf)
                {
                    dbExecutor.Execute(
                        "DELETE por FROM PackageOwnerRequests por JOIN PackageRegistrations pr ON pr.[Key] = por.PackageRegistrationKey WHERE pr.[Key] = @packageRegistrationKey",
                        new { packageRegistrationKey = packageRegistration.Key });
                    dbExecutor.Execute(
                        "DELETE pro FROM PackageRegistrationOwners pro JOIN PackageRegistrations pr ON pr.[Key] = pro.PackageRegistrationKey WHERE pr.[Key] = @packageRegistrationKey",
                        new { packageRegistrationKey = packageRegistration.Key });
                    dbExecutor.Execute(
                        "DELETE FROM PackageRegistrations WHERE [Key] = @packageRegistrationKey",
                        new { packageRegistrationKey = packageRegistration.Key });
                }
            }

            Log.Info(
                "Deleted package registration and all package versions for '{0}'.",
                PackageId);
        }
        public override void ExecuteCommand()
        {
            Log.Info(
                "Deleting package registration and all package versions for '{0}'.",
                PackageId);

            using (var sqlConnection = new SqlConnection(ConnectionString.ConnectionString))
                using (var dbExecutor = new SqlExecutor(sqlConnection))
                {
                    sqlConnection.Open();

                    var packageRegistration = Util.GetPackageRegistration(
                        dbExecutor,
                        PackageId);
                    var packages = Util.GetPackages(
                        dbExecutor,
                        packageRegistration.Key);

                    foreach (var package in packages)
                    {
                        var task = new DeletePackageVersionTask {
                            ConnectionString = ConnectionString,
                            BackupStorage    = BackupStorage,
                            StorageAccount   = StorageAccount,
                            PackageId        = package.Id,
                            PackageVersion   = package.Version,
                            Reason           = Reason,
                            WhatIf           = WhatIf
                        };
                        task.ExecuteCommand();
                    }

                    Log.Info(
                        "Deleting package registration data for '{0}'",
                        packageRegistration.Id);
                    if (!WhatIf)
                    {
                        dbExecutor.Execute(
                            "DELETE por FROM PackageOwnerRequests por JOIN PackageRegistrations pr ON pr.[Key] = por.PackageRegistrationKey WHERE pr.[Key] = @packageRegistrationKey",
                            new { packageRegistrationKey = packageRegistration.Key });
                        dbExecutor.Execute(
                            "DELETE pro FROM PackageRegistrationOwners pro JOIN PackageRegistrations pr ON pr.[Key] = pro.PackageRegistrationKey WHERE pr.[Key] = @packageRegistrationKey",
                            new { packageRegistrationKey = packageRegistration.Key });
                        dbExecutor.Execute(
                            "DELETE FROM PackageRegistrations WHERE [Key] = @packageRegistrationKey",
                            new { packageRegistrationKey = packageRegistration.Key });
                    }
                }

            Log.Info(
                "Deleted package registration and all package versions for '{0}'.",
                PackageId);
        }