ecengel
9/26/2018 - 4:59 AM

QueryOptionV3

 public class QueryOption
    {
        internal List<Expression<Func<Contact, object>>> EagerLoads { get; set; }
        internal Expression<Func<Contact, bool>> Filter { get; set; }

        public QueryOption FilterBy(Expression<Func<Contact, bool>> filter)
        {
            Filter = filter;
            return this;
        }

        public QueryOption AddEagerLoad(Expression<Func<Contact, object>> eagerLoad)
        {
            if(EagerLoads == null)
                EagerLoads = new List<Expression<Func<Contact, object>>>();

            EagerLoads.Add(eagerLoad);
            return this;
        }
    }