I had troubles joining two Tables and continued to receive the "cannot be inferred from the usage. Try specifying the type arguments explicitly.".
"Error 2 The type arguments for method 'System.Linq.Enumerable.Join(System.Collections.Generic.IEnumerable, System.Collections.Generic.IEnumerable, System.Func, System.Func, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly. C:\Pro Asp.net Mvc 5\Chapter 13\1\SportsStore - Copy\SportsStore.WebUI\Controllers\DocProductController.cs 29 17 SportsStore.WebUI"
Can anybody help me?
public class DocProductController : Controller
{
private IDocProductRepository repository;
private IDocMainRepository repositoryMain;
public DocProductController(IDocProductRepository docProductRepository, IDocMainRepository docMainRepository)
{
this.repository = docProductRepository;
this.repositoryMain = docMainRepository;
}
public ViewResult List()
{
DocProductListView model = new DocProductListView
{
DocProduct = repository.DocProduct
.Join(repositoryMain.DocMain,
docProduct => docProduct,
docMain => docMain.Doc_Id,
(docProduct, docMain) => new { a = docMain.Doc_Id, b = docProduct.Doc_Id })
//.OrderByDescending(n => n.DocMain)
};
return View(model);
}
}
public partial class DocMain
{
public int Doc_Id { get; set; }
public Nullable<int> Category_Id { get; set; }
public string Doc_Title { get; set; }
public Nullable<int> Doc_Order { get; set; }
public Nullable<byte> Doc_IsAudit { get; set; }
public Nullable<int> Doc_Clicks { get; set; }
public string Doc_TitleColor { get; set; }
public string Doc_Author { get; set; }
public Nullable<int> User_Id { get; set; }
public string Doc_Source { get; set; }
public string Doc_Thumb { get; set; }
public Nullable<System.DateTime> Doc_DisplayTime { get; set; }
public Nullable<System.DateTime> Doc_ReleaseTime { get; set; }
public Nullable<System.DateTime> Doc_UpdateTime { get; set; }
public string Doc_SEO_Title { get; set; }
public string Doc_SEO_Description { get; set; }
public string Doc_SEO_Keywords { get; set; }
public string Doc_RedirectUrl { get; set; }
public Nullable<byte> Doc_GenerateHTML { get; set; }
public string Doc_HTMLCatagory { get; set; }
}
public partial class DocProduct
{
public int Doc_Id { get; set; }
public Nullable<int> Category_Id { get; set; }
public string DocProduct_Content { get; set; }
}