コード例 #1
0
        public bool Install()
        {
            var  inspector  = new DbInspector(this.Tenant);
            bool hasDb      = inspector.HasDb();
            bool canInstall = inspector.IsWellKnownDb();

            if (hasDb)
            {
                Log.Verbose($"No need to create database \"{this.Tenant}\" because it already exists.");
            }

            if (!canInstall)
            {
                Log.Verbose(
                    $"Cannot create a database under the name \"{this.Tenant}\" because the name is not a well-known tenant name.");
            }

            if (!hasDb && canInstall)
            {
                Log.Information($"Creating database \"{this.Tenant}\".");
                this.CreateDb();
                return(true);
            }

            return(false);
        }
コード例 #2
0
ファイル: DbInstaller.cs プロジェクト: frapid/frapid
        public async Task<bool> InstallAsync()
        {
            string meta = DbProvider.GetMetaDatabase(this.Tenant);
            var inspector = new DbInspector(this.Tenant, meta);
            bool hasDb = await inspector.HasDbAsync().ConfigureAwait(false);
            bool isWellKnown = inspector.IsWellKnownDb();

            if (hasDb)
            {
                if (IsDevelopment())
                {
                    InstallerLog.Verbose("Cleaning up the database.");
                    await this.CleanUpDbAsync();
                }
                else
                {
                    InstallerLog.Verbose($"No need to create database \"{this.Tenant}\" because it already exists.");
                }
            }

            if (!isWellKnown)
            {
                InstallerLog.Verbose(
                    $"Cannot create a database under the name \"{this.Tenant}\" because the name is not a well-known tenant name.");
            }

            if (!hasDb && isWellKnown)
            {
                InstallerLog.Information($"Creating database \"{this.Tenant}\".");
                await this.CreateDbAsync().ConfigureAwait(false);
                return true;
            }

            return false;
        }
コード例 #3
0
ファイル: DbInstaller.cs プロジェクト: manishkungwani/frapid
        public bool Install()
        {
            var inspector = new DbInspector(this.Catalog);
            bool hasDb = inspector.HasDb();
            bool canInstall = inspector.IsWellKnownDb();

            if (!hasDb && canInstall)
            {
                return this.CreateDb();
            }

            return false;
        }
コード例 #4
0
        public bool Install()
        {
            var  inspector  = new DbInspector(this.Catalog);
            bool hasDb      = inspector.HasDb();
            bool canInstall = inspector.IsWellKnownDb();

            if (!hasDb && canInstall)
            {
                return(this.CreateDb());
            }

            return(false);
        }
コード例 #5
0
        public async Task <bool> InstallAsync()
        {
            string meta      = DbProvider.GetMetaDatabase(this.Tenant);
            var    inspector = new DbInspector(this.Tenant, meta);
            bool   hasDb     = await inspector.HasDbAsync().ConfigureAwait(false);

            bool isWellKnown = inspector.IsWellKnownDb();

            if (hasDb)
            {
                if (IsDevelopment())
                {
                    InstallerLog.Verbose("Cleaning up the database.");
                    await this.CleanUpDbAsync().ConfigureAwait(true);
                }
                else
                {
                    InstallerLog.Information("Warning: database already exists. Please remove the database first.");
                    InstallerLog.Verbose($"No need to create database \"{this.Tenant}\" because it already exists.");
                }
            }

            if (!isWellKnown)
            {
                InstallerLog.Verbose(
                    $"Cannot create a database under the name \"{this.Tenant}\" because the name is not a well-known tenant name.");
            }

            if (!hasDb && isWellKnown)
            {
                InstallerLog.Information($"Creating database \"{this.Tenant}\".");
                await this.CreateDbAsync().ConfigureAwait(false);

                return(true);
            }

            return(false);
        }