コード例 #1
0
        /// <summary>
        /// Handles a create database request
        /// </summary>
        internal static async Task HandleCreateDatabaseRequest(
            CreateDatabaseParams databaseParams,
            RequestContext <CreateDatabaseResponse> requestContext)
        {
            var            response = new DefaultDatabaseInfoResponse();
            ConnectionInfo connInfo;

            AdminService.ConnectionServiceInstance.TryFindConnection(
                databaseParams.OwnerUri,
                out connInfo);

            if (taskHelper == null)
            {
                taskHelper = CreateDatabaseTaskHelper(connInfo);
            }

            DatabasePrototype prototype = taskHelper.Prototype;

            DatabaseTaskHelper.ApplyToPrototype(databaseParams.DatabaseInfo, taskHelper.Prototype);

            Database db = prototype.ApplyChanges();

            if (db != null)
            {
                taskHelper = null;
            }

            await requestContext.SendResult(new CreateDatabaseResponse()
            {
                Result = true,
                TaskId = 0
            });
        }
コード例 #2
0
        /// <summary>
        /// Handles a create database request
        /// </summary>
        internal static async Task HandleCreateDatabaseRequest(
            CreateDatabaseParams databaseParams,
            RequestContext <CreateDatabaseResponse> requestContext)
        {
            try
            {
                var            response = new DefaultDatabaseInfoResponse();
                ConnectionInfo connInfo;
                AdminService.ConnectionServiceInstance.TryFindConnection(
                    databaseParams.OwnerUri,
                    out connInfo);

                using (var taskHelper = CreateDatabaseTaskHelper(connInfo))
                {
                    DatabasePrototype prototype = taskHelper.Prototype;
                    DatabaseTaskHelper.ApplyToPrototype(databaseParams.DatabaseInfo, taskHelper.Prototype);

                    Database db = prototype.ApplyChanges();

                    await requestContext.SendResult(new CreateDatabaseResponse()
                    {
                        Result = true,
                        TaskId = 0
                    });
                }
            }
            catch (Exception ex)
            {
                await requestContext.SendError(ex.ToString());
            }
        }
コード例 #3
0
        /// <summary>
        /// Handle a request for the default database prototype info
        /// </summary>
        public static async Task HandleDefaultDatabaseInfoRequest(
            DefaultDatabaseInfoParams optionsParams,
            RequestContext <DefaultDatabaseInfoResponse> requestContext)
        {
            var            response = new DefaultDatabaseInfoResponse();
            ConnectionInfo connInfo;

            AdminService.ConnectionServiceInstance.TryFindConnection(
                optionsParams.OwnerUri,
                out connInfo);

            if (taskHelper == null)
            {
                taskHelper = CreateDatabaseTaskHelper(connInfo);
            }

            response.DefaultDatabaseInfo = DatabaseTaskHelper.DatabasePrototypeToDatabaseInfo(taskHelper.Prototype);
            await requestContext.SendResult(response);
        }
コード例 #4
0
        /// <summary>
        /// Handle a request for the default database prototype info
        /// </summary>
        public static async Task HandleDefaultDatabaseInfoRequest(
            DefaultDatabaseInfoParams optionsParams,
            RequestContext <DefaultDatabaseInfoResponse> requestContext)
        {
            try
            {
                var            response = new DefaultDatabaseInfoResponse();
                ConnectionInfo connInfo;
                AdminService.ConnectionServiceInstance.TryFindConnection(
                    optionsParams.OwnerUri,
                    out connInfo);

                using (var taskHelper = CreateDatabaseTaskHelper(connInfo))
                {
                    response.DefaultDatabaseInfo = DatabaseTaskHelper.DatabasePrototypeToDatabaseInfo(taskHelper.Prototype);
                    await requestContext.SendResult(response);
                }
            }
            catch (Exception ex)
            {
                await requestContext.SendError(ex.ToString());
            }
        }