S
shapper
Hello,
I am loading data from Two XML Files using Linq:
IQueryable<Product> ps = (from p in Products.Root.Elements("Product")
orderby p.Element
("Updated").Value descending
select new Product {
Id = new Guid
(p.Element("ProductId").Value),
Name = p.Element
("Name").Value,
Brand = (from b in
Brands.Root.Elements("Brand")
where b.Element
("BrandId").Value == p.Id.ToString()
select new Brand {
Id = new Guid
(b.Element("BrandId").Value),
Name = b.Element
("Name").Value
}).SingleOrDefault()
}).AsQueryable();
My problem is when getting the Brand for each Product:
where b.Element("BrandId").Value == p.Id.ToString()
p.Id is not recognized.
How can I get the product Id to get the Brand for that Product?
I am using XML not SQL ...
Thanks,
Miguel
I am loading data from Two XML Files using Linq:
IQueryable<Product> ps = (from p in Products.Root.Elements("Product")
orderby p.Element
("Updated").Value descending
select new Product {
Id = new Guid
(p.Element("ProductId").Value),
Name = p.Element
("Name").Value,
Brand = (from b in
Brands.Root.Elements("Brand")
where b.Element
("BrandId").Value == p.Id.ToString()
select new Brand {
Id = new Guid
(b.Element("BrandId").Value),
Name = b.Element
("Name").Value
}).SingleOrDefault()
}).AsQueryable();
My problem is when getting the Brand for each Product:
where b.Element("BrandId").Value == p.Id.ToString()
p.Id is not recognized.
How can I get the product Id to get the Brand for that Product?
I am using XML not SQL ...
Thanks,
Miguel