Пример #1
0
 public void Visit(TableRelation component)
 {
     sql.Append(" " + TranslateJoinType(component.JoinType) + " ");
     component.ForeignTable.Accept(this);
     sql.Append(" ON ");
     component.LocalForeignKeys.First().Accept(this);
     foreach (var key in component.LocalForeignKeys.Skip(1))
     {
         sql.Append(" AND ");
         key.Accept(this);
     }
 }
Пример #2
0
        public QueryBuilder RightJoin(ISqlTable table, ISqlTable foreignTable, params LocalForeignKey[] foreignKeys)
        {
            var relation = new TableRelation
            {
                Table            = table,
                ForeignTable     = foreignTable,
                JoinType         = TableJoinType.RightJoin,
                LocalForeignKeys = foreignKeys.ToList()
            };

            query.JoinTables.Add(relation);

            return(this);
        }
Пример #3
0
        public QueryBuilder InnerJoin(ISqlTable table, ISqlTable foreignTable, ISqlField localKey, ISqlField foreignKey)
        {
            var relation = new TableRelation
            {
                Table        = table,
                ForeignTable = foreignTable,
                JoinType     = TableJoinType.InnerJoin
            };

            relation.LocalForeignKeys.Add(new LocalForeignKey(localKey, foreignKey));

            query.JoinTables.Add(relation);

            return(this);
        }