Exemple #1
0
        public SelectFromQueryBuilder <TEntity> Join(Entity otherTable, Attribute myKey, Attribute otherKey)
        {
            var entity = _ctx.Schema.EntityTypeMap[typeof(TEntity)];
            var join   = new InnerJoin(_from ?? new EntityFrom(entity), myKey, new EntityFrom(otherTable), otherKey);

            return(new SelectFromQueryBuilder <TEntity>(_ctx, join));
        }
Exemple #2
0
        public SelectFromQueryBuilder <TEntity> Join(string otherTable, string myKey, string otherKey)
        {
            var entity    = _ctx.Schema.EntityTypeMap[typeof(TEntity)];
            var myKeyAttr = entity.Attributes.Values.First(attr => attr.DataBaseColumn == myKey);

            var otherEntity  = _ctx.Schema.EntityTypeMap.Values.First(e => e.TableName == otherTable);
            var otherKeyAttr = otherEntity.Attributes.Values.First(attr => attr.DataBaseColumn == otherKey);

            var join = new InnerJoin(_from ?? new EntityFrom(entity), myKeyAttr, new EntityFrom(otherEntity), otherKeyAttr);

            return(new SelectFromQueryBuilder <TEntity>(_ctx, join));
        }