Ejemplo n.º 1
0
        public StaticSelectBuilder <T> Join <TParent, TChild>(Expression <Func <TChild, TParent> > childProperty, string parentAlias = null, string childAlias = null)
        {
            var childPropertyInfo = Reflector <T> .GetProperty(childProperty);

            var joinSpecification = ObjectSubQueryJoin.CreateChildToParent(childPropertyInfo, typeof(TParent));

            Join(joinSpecification, parentAlias, childAlias);

            return(this);
        }
Ejemplo n.º 2
0
        private StaticSelectBuilder <T> JoinWithForeignKeyProperty <TParent, TChild>(Expression <Func <TParent, IList <TChild> > > parentProperty, PropertyInfo foreignKeyPropertyInfo, string parentAlias = null, string childAlias = null)
        {
            var parentPropertyInfo = Reflector <T> .GetProperty(parentProperty);

            var joinSpecification = ObjectSubQueryJoin.CreateParentToChild(parentPropertyInfo, foreignKeyPropertyInfo);

            Join(joinSpecification, parentAlias, childAlias);

            return(this);
        }
Ejemplo n.º 3
0
 public static ObjectRelation Create(ObjectSubQueryJoin @join, string childAlias, string parentAlias)
 {
     return(new ObjectRelation
     {
         ChildProperty = @join.ChildProperty,
         ParentProperty = @join.ParentProperty,
         ChildType = @join.ChildType,
         ParentType = @join.ParentType,
         ChildAlias = childAlias,
         ParentAlias = parentAlias
     });
 }
Ejemplo n.º 4
0
        public StaticSelectBuilder <T> Join <TParent, TChild>(
            Expression <Func <TParent, IList <TChild> > > parentProperty,
            Expression <Func <TChild, TParent> > childProperty,
            string parentAlias = null,
            string childAlias  = null)
        {
            var parentPropertyInfo = Reflector <TParent> .GetProperty(parentProperty);

            var childPropertyInfo = Reflector <TChild> .GetProperty(childProperty);

            var joinSpecification = ObjectSubQueryJoin.CreateTwoWay(parentPropertyInfo, childPropertyInfo);

            Join(joinSpecification, parentAlias, childAlias);

            return(this);
        }
Ejemplo n.º 5
0
 private void Join(ObjectSubQueryJoin joinSpecification, string parentAlias, string childAlias)
 {
     _sqlQuery.AddJoin(joinSpecification, childAlias, parentAlias);
 }