Types in Union or Concat cannot be constructed with hierarchy

YAbieXue

New Member
I am trying to run a query very similar to the following:\[code\](from bs in DataContext.TblBookShelfjoin b in DataContext.Book on bs.BookID equals b.BookIDwhere bs.BookShelfID == bookShelfID select new BookItem{ Categories = String.Join("<br/>", b.BookCategories.Select(x => x.Name).DefaultIfEmpty().ToArray()), Name = b.Name,ISBN = b.ISBN,BookType = "Shelf"}).Union(from bs in DataContext.TblBookShelfjoin bi in DataContext.TblBookInventory on bs.BookID equals bi.BookID select new BookItem { Categories = String.Join("<br/>", bi.BookCategories.Select(x => x.Name).DefaultIfEmpty().ToArray()), Name = bi.Name, ISBN = bi.ISBN, BookType = "Inventory"});\[/code\]I am receiving "Types in Union or Concat cannot be constructed with hierarchy" after the statement executes, I need to to be able to get a list of categories to display with each book. If anyone could shed some light on a possible solution, it would be greatly appreciated.
 
Back
Top