When I'm collecting data from more than one table its throwing exception. The specified LINQ expression contains references to queries that are associated with different contexts.
public partial class EfRepository : IRepository where T : class
{
private readonly WebEntities _context;
private IDbSet _entities;
public EfRepository(WebEntities context)
{
this._context = context;
}
public virtual IQueryable Table
{
get
{
return this.Entities;
}
}
protected virtual IDbSet Entities
{
get
{
if (_entities == null)
_entities = _context.Set();
return _entities;
}
}
}
Query on Service.cs
var query = from rc in _FAQRepository.Table
join r in _FAQCategoryRepository.Table on rc.FAQCategoryID equals r.FAQCategoryID
select rc;
return query.ToList();
VulpesPosted Dec 8, 2014, 9:15 AM