the problem comes from that you have used OQL to fetch the data and than LINQ to filter the result set. Now this is of course possible but the actually filtering is done on the client side rather than on the server side and for big amounts of data this can prove to be time consuming. The better aproach will be to retrieve only the records that are going to be shown to the customer.
You can use LINQ to achieve this:
|var result = (from c in ObjectScopeProvider1.GetNewObjectScope().Extent<VARMSContract>() where c.ContractID == ContractID select c).First();
Or using OQL:
| IQuery query = ObjectScopeProvider1.GetNewObjectScope().GetOqlQuery("Select * from VARMSContractExtent where ContractID = $1");
| query.MaxResultCount = 1;
| var result = query.Execute(ContractID);
Note that in the OQL example we are setting the MaxResultCount property so that we get only 1 entry as a result since there is no First() operant in OQL.
the Telerik team