我目前正在使用LINQ从DatabaseContext实例获取数据。
using (var dbContext = new DataContext("Data Source=localhost;Initial Catalog=BillingApp;Integrated Security=True;"))
{
Table<ServiceContract> service_contracts = dbContext.GetTable<ServiceContract>();
Table<Corporation> corporations = dbContext.GetTable<Corporation>();
IEnumerable<ServiceContract> tmp = from sc in service_contracts
join corp in corporations on sc.corp_id equals corp.corporation_id
select sc.corp_id;
}
然而,系统在单词 - join下显示红线。信息如下:
The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'