Ejemplo n.º 1
0
        internal EntityExpression WithExpandEntity(ExpandEntity expandEntity)
        {
            switch (expandEntity)
            {
            case ExpandEntity.EagerEntity:
                return(new EntityExpression(this.Type, this.ExternalId, this.TableAlias, this.Bindings, this.Mixins, avoidExpandOnRetrieving: false));

            case ExpandEntity.LazyEntity:
                return(new EntityExpression(this.Type, this.ExternalId, this.TableAlias, this.Bindings, this.Mixins, avoidExpandOnRetrieving: true));

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 2
0
        public static IQueryable <T> ExpandEntity <T, L>(this IQueryable <T> source, Expression <Func <T, L> > entitySelector, ExpandEntity expandEntity)
            where L : class, IEntity
        {
            if (source == null)
            {
                throw new ArgumentNullException("query");
            }

            return(source.Provider.CreateQuery <T>(Expression.Call(null, ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(T), typeof(L) }), new Expression[] { source.Expression, Expression.Quote(entitySelector), Expression.Constant(expandEntity) })));
        }