Example #1
0
        public static IncludePaths Create <TEntity>(params Expression <Func <TEntity, object> >[] paths)
        {
            var include = new IncludePaths();

            foreach (var item in paths)
            {
                include.Paths.Add(IncludePath.Create <TEntity>(item));
            }
            return(include);
        }
Example #2
0
        public static IncludePath Create <TEntity>(System.Linq.Expressions.Expression <Func <TEntity, object> > path)
        {
            var include = new IncludePath();

            var body = path.Body;

            string pathString = null;

            if (!TryGetPath(body, out pathString))
            {
                throw new ArgumentException("The given path expression is not valid", "path");
            }

            include.Path       = pathString;
            include.EntityType = typeof(TEntity);

            return(include);
        }