This has been ruining my life for a few days now, time to ask...

I am using Entity Framework 4.0 for my app.

A Location (such as a house or office) has one or more facilities (like a bathroom, bedroom, snooker table etc..)

I want to display a checkbox list on the location page, with a checkbox list of facilities, with the ones checked that the location currently has.

My View Model for the facilities goes like this...

public class FacilityViewItem
{
    public int Id { get; set; }
    public string Name { get; set; }
    public bool Checked { get; set; }
}

So when im passing the Location View Model to the UI, i want to pass a List<T> of facilities where T is of type FacilityViewItem.

To get the facilities that the location already has is simple - i make a query using Location.Facilities which returns an EntityCollection where T is of type Facility. This is because Facilities is a navigation property....

var facs = from f in location.Facilities
select new FacilityViewItem()
{
    Id = f.FacilityId,
    Name = f.Name,
    Checked = true
};

So here is where my problem lies - i want the rest of the facilities, the ones that the Location does not have.

I have tried using Except() and Any() and Contains() but i get the same error.

Examples of queries that do not work...

var restOfFacilities = from f in ctx.Facilities
    where !hasFacilities.Contains(f)
    select new FacilityViewItem()
        {
            Id = f.FacilityId,
            Name = f.Name
        };

var restOfFacilities = ctx.Facilities.Except(facilitiesThatLocationHas);

var notFacs = from e in ctx.Facilities
where !hasFacilities.Any(m => m.FacilityId == e.FacilityId)
    select new FacilityViewItem()
        {
            Id = e.FacilityId,
            Name = e.Name
        };

And the error i get with every implementation...<

Edit
Report