Пример #1
0
        /// <summary>
        /// Handles request to generate deploy script
        /// </summary>
        /// <returns></returns>
        public async Task HandleGenerateDeployScriptRequest(GenerateDeployScriptParams parameters, RequestContext <DacFxResult> requestContext)
        {
            try
            {
                ConnectionInfo connInfo;
                ConnectionServiceInstance.TryFindConnection(
                    parameters.OwnerUri,
                    out connInfo);
                if (connInfo != null)
                {
                    GenerateDeployScriptOperation operation = new GenerateDeployScriptOperation(parameters, connInfo);
                    SqlTask      sqlTask  = null;
                    TaskMetadata metadata = new TaskMetadata();
                    metadata.TaskOperation     = operation;
                    metadata.TaskExecutionMode = parameters.TaskExecutionMode;
                    metadata.ServerName        = connInfo.ConnectionDetails.ServerName;
                    metadata.DatabaseName      = parameters.DatabaseName;
                    metadata.Name = SR.GenerateScriptTaskName;

                    sqlTask = SqlTaskManagerInstance.CreateAndRun <SqlTask>(metadata);

                    await requestContext.SendResult(new DacFxResult()
                    {
                        OperationId  = operation.OperationId,
                        Success      = true,
                        ErrorMessage = string.Empty
                    });
                }
            }
            catch (Exception e)
            {
                await requestContext.SendError(e);
            }
        }
Пример #2
0
        /// <summary>
        /// Handles request to generate deploy script
        /// </summary>
        /// <returns></returns>
        public async Task HandleGenerateDeployScriptRequest(GenerateDeployScriptParams parameters, RequestContext <DacFxResult> requestContext)
        {
            try
            {
                ConnectionInfo connInfo;
                ConnectionServiceInstance.TryFindConnection(
                    parameters.OwnerUri,
                    out connInfo);
                if (connInfo != null)
                {
                    GenerateDeployScriptOperation operation = new GenerateDeployScriptOperation(parameters, connInfo);
                    SqlTask      sqlTask  = null;
                    TaskMetadata metadata = TaskMetadata.Create(parameters, SR.GenerateScriptTaskName, operation, ConnectionServiceInstance);

                    // want to show filepath in task history instead of server and database
                    metadata.ServerName   = parameters.ScriptFilePath;
                    metadata.DatabaseName = string.Empty;

                    sqlTask = SqlTaskManagerInstance.CreateAndRun <SqlTask>(metadata);

                    await requestContext.SendResult(new DacFxResult()
                    {
                        OperationId  = operation.OperationId,
                        Success      = true,
                        ErrorMessage = string.Empty
                    });
                }
            }
            catch (Exception e)
            {
                await requestContext.SendError(e);
            }
        }