We have scalar functions in our database for returning things like \"number of tasks for a customer\" or \"total invoice amount for a customer\".
We are experiment
I believe this MSDN documentation is what you're after (as part of this wider topic of calling user-defined functions in LINQ to SQL). Can't say I've done it myself, but it sounds right...