Exemplo n.º 1
0
        private static IQueryable <Book> BookEagerFetch(AbstractRepository repo)
        {
            var books      = repo.EntitySet <Book>();
            var categories = repo.EntitySet <Category>();
            var formats    = repo.EntitySet <Format>();

            var outerJoin = from b in books
                            join c in categories on b.Category.Id equals c.Id into gs
                            from g in gs.DefaultIfEmpty()
                            join f in formats on b.Format.Id equals f.Id into gj
                            from h in gj.DefaultIfEmpty()
                            select new Book
            {
                Id       = b.Id,
                Title    = b.Title,
                Isbn     = b.Isbn,
                Category = g,
                Format   = h
            };

            return(outerJoin);
        }