Exemple #1
0
 public override void Visit(EnableForeignKey dfkCommand)
 {
     _Query.Append(ALTER).Append(TABLE).Append(FormatAttribute(dfkCommand.Table)).Append(SPACE).Append(CHECK).Append(CONSTRAINT).Append(ALL);
 }
Exemple #2
0
 public override void Visit(EnableForeignKey dfkCommand)
 {
 }
Exemple #3
0
 public override void Visit(EnableForeignKey dfkCommand)
 {
     _Query.Append(SET).Append(FOREIGN_KEY_CHECKS_1);
 }
        public void EnableForeignKeys()
        {
            EnableForeignKey dfk = null;

            switch (_Dialect.GetDisableForeignKeyScope())
            {
                case DBDialect.ForeignKeyScope.None:
                    return;

                case DBDialect.ForeignKeyScope.DataBase:

                    if (_DisableDataBase)
                    {
                        dfk = new EnableForeignKey(DBDialect.ForeignKeyScope.DataBase);
                        ExecuteCommand(dfk);
                    }

                    break;

                case DBDialect.ForeignKeyScope.Table:

                    foreach (string tableName in _DisabledTableNames)
                    {
                        dfk = new EnableForeignKey(DBDialect.ForeignKeyScope.Table);
                        dfk.Table = tableName;
                        ExecuteCommand(dfk);
                    }

                    break;

                case DBDialect.ForeignKeyScope.Constraint:

                    foreach (string tableName in _DisabledTableNames)
                    {
                        foreach (EntityMapping em in _Mapping.Entities)
                            foreach (ReferenceMapping refm in em.References)
                                foreach (RuleMapping rm in refm.Rules)
                                {
                                    if (rm.Constraint != null && rm.Constraint != String.Empty && rm.ParentTable == tableName)
                                    {
                                        dfk = new EnableForeignKey(DBDialect.ForeignKeyScope.Constraint);
                                        dfk.Table = tableName;
                                        dfk.Name = rm.Constraint;
                                        ExecuteCommand(dfk);
                                    }
                                }
                    }

                    break;
            }
        }
Exemple #5
0
 public override void Visit(EnableForeignKey dfkCommand)
 {
     _Query.Append(ALTER).Append(TABLE).Append(FormatTableAlias(dfkCommand.Table)).Append(SPACE).Append(ENABLE).Append(CONSTRAINT).Append(FormatTableAlias(dfkCommand.Name));
 }
Exemple #6
0
 public abstract void Visit(EnableForeignKey dfkCommand);