コード例 #1
0
        public void UpdateDataBaseSchema()
        {
            ISchemaHandler handler = this.GetSchemaHandler();
            string         script  = null;

            try
            {
                script = handler.CreateUpdateDDLScript(null);
            }
            catch
            {
                bool throwException = false;
                try
                {
                    handler.CreateDatabase();
                    script = handler.CreateDDLScript();
                }
                catch
                {
                    throwException = true;
                }
                if (throwException)
                {
                    throw;
                }
            }

            if (string.IsNullOrEmpty(script) == false)
            {
                handler.ExecuteDDLScript(script);
            }
        }
コード例 #2
0
ファイル: OmletSchemaHandler.cs プロジェクト: amacal/omlet
        public OmletSchemaHandler(ISchemaHandler handler)
        {
            if (handler != null)
            {
                onRequest = handler.OnBrokenRequest;
                onResponse = handler.OnBrokerResponse;
            }

            onRequest = onRequest ?? OnRequestFallback;
            onResponse = onResponse ?? OnResponseFallback;
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Varbanov/TelerikAcademy
 private static void EnsureDB(ISchemaHandler schemaHandler)
 {
     string script = null;
     if (schemaHandler.DatabaseExists())
     {
         script = schemaHandler.CreateUpdateDDLScript(null);
     }
     else
     {
         schemaHandler.CreateDatabase();
         script = schemaHandler.CreateDDLScript();
     }
     if (!string.IsNullOrEmpty(script))
     {
         schemaHandler.ExecuteDDLScript(script);
     }
 }
コード例 #4
0
ファイル: DDLBuilder.cs プロジェクト: maddux456/TeamThing
        private static string GenerateScript(ISchemaHandler handler, TextWriter log)
        {
            string ddlScript = string.Empty;

            if (!handler.DatabaseExists())
            {
                TryLogMessage(log, "Creating database script...");
                ddlScript = handler.CreateDDLScript();
            }
            else
            {
                TryLogMessage(log, "Database exists, creating migration script...");
                ddlScript = handler.CreateUpdateDDLScript(
                    new Telerik.OpenAccess.SchemaUpdateProperties());
            }
            return(ddlScript);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: Varbanov/TelerikAcademy
        private static void EnsureDB(ISchemaHandler schemaHandler)
        {
            string script = null;

            if (schemaHandler.DatabaseExists())
            {
                script = schemaHandler.CreateUpdateDDLScript(null);
            }
            else
            {
                schemaHandler.CreateDatabase();
                script = schemaHandler.CreateDDLScript();
            }
            if (!string.IsNullOrEmpty(script))
            {
                schemaHandler.ExecuteDDLScript(script);
            }
        }
コード例 #6
0
ファイル: DDLBuilder.cs プロジェクト: maddux456/TeamThing
        private static void ExecuteScript(string ddlScript, ISchemaHandler handler, TextWriter log)
        {
            if (!string.IsNullOrEmpty(ddlScript))
            {
                if (!handler.DatabaseExists())
                {
                    TryLogMessage(log, "Database does not exist, creating database..");
                    handler.CreateDatabase();
                }

                TryLogMessage(log, "Updating database schema...");
                //This is the call that modifies the databaschema. Use with care.
                handler.ExecuteDDLScript(ddlScript);
            }
            else
            {
                TryLogMessage(log, "No changes to make.");
            }
        }
コード例 #7
0
ファイル: FluentModel.cs プロジェクト: xin2015/TelerikStudy
        public void UpdateSchema()
        {
            ISchemaHandler schemaHandler = GetSchemaHandler();
            string         script        = null;

            if (schemaHandler.DatabaseExists())
            {
                script = schemaHandler.CreateUpdateDDLScript(null);
            }
            else
            {
                schemaHandler.CreateDatabase();
                script = schemaHandler.CreateDDLScript();
            }
            if (!string.IsNullOrEmpty(script))
            {
                schemaHandler.ExecuteDDLScript(script);
            }
        }