var svc = new LocationDataServiceContext();
var q = from c in svc.LocationTable
where c.ID == int.Parse(location.ID)
select c;
if (q.ToArray().Length == 0)
id there a neater way to do this?
From stackoverflow
-
yes, I believe so...
var svc = new LocationDataServiceContext(); if (svc.LocationTable.SingleOrDefault(c => c.ID == int.Parse(location.ID) != null)) { }I thought there was an Exist() method... but I guess not.
J.13.L : The Exist() method is part of IListor one of its bases... But you would want to convert it to a List cause then you'd be pulling all the records...
0 comments:
Post a Comment