You can build a Scalar Query in code, several ways to do that depending on the case.
e.g. adapter.GetScalar(...);
But your case seems different as you want to call a database function that is scalar.
And if the call is not part of a query, like calling the function in a predict or in the select list, then your best bet would be to include it in a StoredProcedure, and get an SP call mapped.
If not scalar, then you can have a TableValuedFunction call mapped in the designer.