Explicit construction of entity type '###' in query is not allowed.
Issue
Explicit construction of entity type '###' in query is not allowed.Solution
var result = from ev in db.Events
join ea in db.EventAttendees on ev.EventId equals ea.EventId
where ea.UserId == userid
select new VMEvent // Here Don't use actual entity class name, Create new view model class
{
EventName = ev.EventName,
EventAttendeeSubmittedDate = ea.SubmittedDate.ToString(),
Place = ev.Place,
EventAttendeeNoofMembers = ea.noofMembers.ToString()
};
var arrayResult = result.ToArray();
var listResult = result.ToList();
Hope this will help you and save your time.
Enjoy !!!
:)