Hello, I'm trying to join one Linq collection from Data Base and one from XML file. Is this possible? I always get: Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator.
Here is my code:
MyDataContext dc = new MyDataContext();
XElement CustomData;
var pages = from p in dc.Pages
select new
{
Title = p.Title,
Slug = p.Slug,
PageId = p.PageId.ToString()
};
var orders = from p in CustomData.Element("pages").Elements("page")
select new
{
PageId = (string)p.Attribute("id"),
SortOrder = (int)p.Attribute("sortOrder")
};
var source = from p in pages
join o in orders
on p.PageId equals o.PageId
select p;
source.ToList();