Hi,
I've got 3 tables in my DB: InvoiceDetailLineType, InvoicingCategory, CalculationRule.
InvoiceDetailLineType has foreign keys to both InvoicingCategory and CalculationRule.
I want to retrieve a list of all InvoiceDetailLineType objects for a given category and include the related CalculationRule and InvoicingCategory objects.
Here's my method to do this:
public List<InvoiceDetailLineType> GetAllForCategory(InvoicingCategory category)
{
return (from InvoiceDetailLineType lineType in ContextHelper.Entities.InvoiceDetailLineType.Include("CalculationRule").Include("InvoicingCategory")
where lineType.InvoicingCategory.IdInvoicingCategory == category.IdInvoicingCategory
select lineType).ToList();
}
I would expect this to give me what I need, but what I get back is an object whose CalculationRule is null. I've made sure that the foreign keys are all set up correctly and that the records exist in the database, so it seems a bit odd.
Am I missing something?
Thanks in advance.