TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sudesh chhipa
NA
1
9k
The specified LINQ expression contains references to queries
Dec 8 2014 8:20 AM
I'm getting error after this join. Normal linq query working fine. I'm using database first approach.
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<T> : IRepository<T> where T : class
{
private readonly WebEntities _context;
private IDbSet<T> _entities;
public EfRepository(WebEntities context)
{
this._context = context;
}
public virtual IQueryable<T> Table
{
get
{
return this.Entities;
}
}
protected virtual IDbSet<T> Entities
{
get
{
if (_entities == null)
_entities = _context.Set<T>();
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();
Reply
Answers (
1
)
List of namespace and methods
How to fix Form's Size and design to any screen resolution