I am using EF 6 in Visual Studio 2013. I want to get matching records from a Parent table on behalf of foreign key from Child table. I have following line of code
var record = db.ChannelFees.Include(x =>x.SubSource).ToList();
Here ChannelFees is the child table in which SubSourceId is foreign key from SubSource(Parent Table).
Channel Fee Class Looks Like:
using System;
using System.Collections.Generic;
public partial class ChannelFee
{
public virtual SubSource SubSource { get; set; }
public int SubSource_id { get; set; }
public double Fee { get; set; }
public int Id { get; set; }
}
and the SubSource Class
using System;
using System.Collections.Generic;
public partial class SubSource
{
public int Id { get; set; }
public string Description { get; set; }
public string MapName { get; set; }
}
But I am getting the following exception.
A specified Include path is not valid. The EntityType 'FinancialManagmentModel.ChannelFee' does not declare a navigation property with the name 'SubSource'.
What is wrong with it?
SubSource! is that typo?