public class UserBuilding
{
[Key, Column(Order = 0)]
public int UserId { get; set; }
[Key, Column(Order = 1)]
public int BuildingId { get; set; }
public int BuildingLevel { get; set; }
}
If I wanted to return all the different buildings that belong to a user, I would do the following:
database.UserBuildings.Where(b => b.UserId == userId);
My question is what if I wanted to return a specific building from a specific user? What would be the most 'efficient' way of doing this? Is there a better way (such as a built-in function) than the following:
database.UserBuildings.Where(b => b.UserId == userId && b.BuildingId == buildingId);