Will the query work without the where clause?
Maybe I'm crazy, but your utility class shouldn't be outputting an IQueryable list. Your creating a local sequence that looks like it should be queryable. Ultimately, IQueryable lists should be delved out by your datacontext. If a utility class is creating a list, that should be returned as (most likely) an array or an IEnumerable, e.g.:
public static readonly ISOCountry[] CountryCodes = new ISOCountry[] {
new ISOCountry { isoCountryCode= "AF", Name= "Afghanistan"},
new ISOCountry { isoCountryCode= "AX", Name= "Aland Islands"}
...
};
A local sequence can only be used in an IQueryable .Contains() statement. So, if you want to "mesh" your local sequence with your IQueryable sequence, you have to force the IQueryable to fire a SQL statement and grab the records it represents from the DB. To do that, all you have to do is iterate over the IQueryable records in some fashion:
IList<Competitor> competitorRecords = competitorRepository
.Competitors
.Where(m => !m.Deleted)
.OrderBy(m => m.countryId)
.ToList(); //this fires the SQL statement
Once you've snagged the records from the db, you can create your list of ISOCountry records. Again, since this list isn't coming from your datacontext, it shouldn't be an IQueryable list. Instead, try this:
IList<ISOCountry> = competitorRecords
.Join(CountryCodes, key1 => key1.countryId, key2 => key2.isoCountryCode, (competitors, codes) => new ISOCountry { isoCountryCode = competitors.countryId, Name = codes.Name })
.ToList();
This will work, but you're probably grabbing unnecessary records from the database. It'd be even better if you could upload your ISOCountry list to the database. Once you do that, you'd be able to fire the query as you initially conceived it.
Hope this helps! Sorry you missed your deadline.