Hi there,
can anyone help?, i am stuck with a linq query..
basically i have a standard linq query that returns fields, 1 field (insurances) is actually another linq query like so
// original from this in etc not included to keep msg short>
select new Models.Custom.House.Insurance()
{
Id = v.IdHouse,
Insurances = from gt in GroupHouseTariffs
join i in InsuranceGroup
on new { gt.IdTariff, gt.IdGroup}
equals
new { i.IdTariff, i.IdGroup}
select new
{
InsuranceId = i.Id,
Price = i.Price
}
basically insurance is injected into the insurance property from Models.Custom.House, it works as i can see it in my debug ... i have 4 records in the insurance .. insurance is defined like this in House which is basically an Iqueryable of another small class..
public IQueryable<Insurance> Insurances { get; set;}
So i tried to write an extension method, like so
public static IQueryable<House> WithInsuranceId(this IQueryable<House> qry, int insuranceId)
{
return from h in qry
where h.Insurance .. // BUT here is the problem i don't see my properties, I see plenty of linq methods
}
I should be able to see insuranceId and do this , no?
return from h in qry
where h.Insurance.InsuranceId == 1;
Here is the class (its very small)
public class Insurance
{
public int? InsuranceId { get; set; }
public float? price{ get; set; }
}
Maybe there is some sort of special lambda i need to know about :-) ?
Any help really appreciated, thank you.