Exemplo n.º 1
0
        private ScriptTranslator <T> GetScriptTranslator <T>(List <T> dbObjects) where T : ScriptDbObject
        {
            ScriptTranslator <T> translator = new ScriptTranslator <T>(sourceInterpreter, this.targetInerpreter, dbObjects)
            {
                SkipError = this.SkipError
            };

            translator.Option           = this.option;
            translator.UserDefinedTypes = this.UserDefinedTypes;
            translator.TargetDbOwner    = this.targetDbOwner;
            translator.OnTranslated    += this.ScriptTranslated;
            translator.Subscribe(this.observer);

            return(translator);
        }
Exemplo n.º 2
0
        public void Translate(DatabaseObjectType databaseObjectType = DatabaseObjectType.None)
        {
            if (this.NeedTranslate(databaseObjectType, DatabaseObjectType.TableColumn))
            {
                ColumnTranslator columnTranslator = new ColumnTranslator(this.sourceInterpreter, this.targetInerpreter, this.targetSchemaInfo.TableColumns);
                this.Translate(columnTranslator);
            }

            if (this.NeedTranslate(databaseObjectType, DatabaseObjectType.TableConstraint))
            {
                ConstraintTranslator constraintTranslator = new ConstraintTranslator(sourceInterpreter, this.targetInerpreter, this.targetSchemaInfo.TableConstraints)
                {
                    SkipError = this.SkipError
                };
                this.Translate(constraintTranslator);
            }

            if (this.NeedTranslate(databaseObjectType, DatabaseObjectType.View))
            {
                ScriptTranslator <View> viewTranslator = this.GetScriptTranslator <View>(this.targetSchemaInfo.Views);
                viewTranslator.Translate();
            }

            if (this.NeedTranslate(databaseObjectType, DatabaseObjectType.Function))
            {
                ScriptTranslator <Function> functionTranslator = this.GetScriptTranslator <Function>(this.targetSchemaInfo.Functions);
                functionTranslator.Translate();
            }

            if (this.NeedTranslate(databaseObjectType, DatabaseObjectType.Procedure))
            {
                ScriptTranslator <Procedure> procedureTranslator = this.GetScriptTranslator <Procedure>(this.targetSchemaInfo.Procedures);
                procedureTranslator.Translate();
            }

            if (this.NeedTranslate(databaseObjectType, DatabaseObjectType.TableTrigger))
            {
                ScriptTranslator <TableTrigger> triggerTranslator = this.GetScriptTranslator <TableTrigger>(this.targetSchemaInfo.TableTriggers);
                triggerTranslator.Translate();
            }

            this.TranslateOwner();
        }