You need to do this:
public decimal GetCustomerBalance(long accountCurrentAdvisorId) {
return this.Table.Where(x => x.AccountCurrentAdvisorId == accountCurrentAdvisorId)
.Select(x => x.CustomerBalance).First();
}
I put in the Github for future reference.
So you make a filter with the Where
, then selects the information you want to pick up - I guessed it would be CustomerBalance
- and finally takes the first result of the generated sequence (even if it already has only one element, after all you want an element and not a sequence containing an element, which are given very different).
To query probable internal generated will be something like this:
SELECT TOP 1 CustomerBalance FROM Table WHERE AccountCurrentAdvisorId = @accountCurrentAdvisorId
This is not really a LINQ query. This is a query using extension methods. LINQ is something else.
– Leonel Sanches da Silva