I have this code block which returns 1 entity using a Take(1)
Is there a more elegant way to get "Top 1" like behaviour?
public static IEntity2 GetConstructionEntity(string Scheme, string Class)
{
var items = (ILLBLGenProQuery) (from x in meta.PropertyOccupancy
where x.Class == Class &&
x.Scheme == Scheme
select x).Take(1);
EntityCollection<PropertyOccupancyEntity> collection = items.Execute<EntityCollection<PropertyOccupancyEntity>>();
if (collection.Count == 1)
return collection[0];
else
return null;
}