Hi, I have a table Admins, which creates a relationship between Users and Locations:
ID - numeric (PK)
UserId - uniqueidentifier (FK to UserId in aspnet_Users table)
LocationId - numeric
Now I want to execute command:
IQueryable<decimal> location_ids = (from m in _db.Admins
where m.UserId.Equals( new Guid("c5d3dc0e-81e6-4d6b-a9c3-faa802e10b7d")) && m.LocationId.Equals(conf.umisteni.Budova.ID)
select m.LocationId);
But for some reason (I guess the UsersId is FK) m.UserId can't be resolved. So I tried to use
m.aspnet_UsersReference.Value.UserId
But then the decision statement
if (!location_ids.Any())
fails with exception
System.NotSupportedException: The specified type member 'aspnet_UsersReference' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
What should I do in order to get the enumerable list of LocationIds?
Thanks in advance.