示例#1
0
        /// <summary>
        /// Contains the logic to Provision the database.
        /// </summary>
        public override void Provision()
        {
            // Stop if the DB has already been provisioned
            if (this.Status == SPObjectStatus.Online)
            {
                return;
            }

            // Update the status to provisioning
            this.Status = SPObjectStatus.Provisioning;
            this.Update();

            // Run the provisioning scripts if we are not attaching to an existing database
            if (!this.Exists)
            {
                // Create any DB options
                //Dictionary<string, bool> options = new Dictionary<string, bool>();
                Dictionary <DatabaseOptions, bool> options = new Dictionary <DatabaseOptions, bool>();
                //options.Add(SPDatabase.SqlDatabaseOption[(int)DatabaseOptions.AutoClose], false);
                options.Add(DatabaseOptions.AutoClose, false);
                SPDatabase.Provision(
                    this.DatabaseConnectionString,
                    //SPUtility.GetGenericSetupPath(@"TEMPLATE\SQL\ClubCloud.Service\CreateDatabase.sql"),
                    SPUtility.GetVersionedGenericSetupPath(@"TEMPLATE\SQL\ClubCloud.Service\ClubCloud.sql", 15),
                    options);
            }

            this.Status = SPObjectStatus.Online;
            this.Update();
        }
        /// <summary>
        /// Provision method override
        /// </summary>
        public override void Provision()
        {
            if (SPObjectStatus.Online == this.Status)
            {
                return;
            }
            this.Status = SPObjectStatus.Provisioning;
            this.Update();

            Dictionary <DatabaseOptions, bool> options = new Dictionary <DatabaseOptions, bool>(1);

            options.Add(DatabaseOptions.AutoClose, false);

            if (!this.Exists)
            {
                SPDatabase.Provision(ConnectString(), SPUtility.GetVersionedGenericSetupPath(@"Template\sql\SharePoint.IdentityService.sql", 15), options);
            }

            this.Status = SPObjectStatus.Online;
            this.Update();
        }