public override object Clone()
        {
            List <SQLiteIndexedColumn> columns = null;

            if (_columns != null)
            {
                columns = new List <SQLiteIndexedColumn>();
                foreach (SQLiteIndexedColumn ic in _columns)
                {
                    columns.Add((SQLiteIndexedColumn)ic.Clone());
                }
            }

            List <SQLiteIndexedColumn> foreignColumns = null;

            if (_foreignColumns != null)
            {
                foreignColumns = new List <SQLiteIndexedColumn>();
                foreach (SQLiteIndexedColumn ic in _foreignColumns)
                {
                    foreignColumns.Add((SQLiteIndexedColumn)ic.Clone());
                }
            }

            List <SQLiteReferenceHandler> handlers = null;

            if (_handlers != null)
            {
                handlers = new List <SQLiteReferenceHandler>();
                foreach (SQLiteReferenceHandler r in _handlers)
                {
                    handlers.Add((SQLiteReferenceHandler)r.Clone());
                }
            }

            SQLiteDeferColumnConstraint deferConstraint = null;

            if (_deferConstraint != null)
            {
                deferConstraint = (SQLiteDeferColumnConstraint)_deferConstraint.Clone();
            }

            SQLiteForeignKeyTableConstraint res = new SQLiteForeignKeyTableConstraint(this.ConstraintName);

            res._columns         = columns;
            res._foreignTable    = _foreignTable;
            res._foreignColumns  = foreignColumns;
            res._handlers        = handlers;
            res._deferConstraint = deferConstraint;
            return(res);
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            SQLiteForeignKeyTableConstraint dst = obj as SQLiteForeignKeyTableConstraint;

            if (dst == null)
            {
                return(false);
            }

            if (!RefCompare.CompareList <SQLiteIndexedColumn>(_columns, dst._columns))
            {
                return(false);
            }
            if (this._foreignTable != dst._foreignTable)
            {
                return(false);
            }
            if (!RefCompare.CompareList <SQLiteIndexedColumn>(_foreignColumns, dst._foreignColumns))
            {
                return(false);
            }
            if (!RefCompare.CompareList <SQLiteReferenceHandler>(_handlers, dst._handlers))
            {
                return(false);
            }
            if (!RefCompare.Compare(_deferConstraint, dst._deferConstraint))
            {
                return(false);
            }

            return(base.Equals(obj));
        }