LINQ to SQL uses methods in your object model to represent user-defined functions. You designate methods as functions by applying the FunctionAttribute attribute and, where required, the ParameterAttribute attribute. For more information, see The LINQ to SQL Object Model.
To avoid an InvalidOperationException, user-defined functions in LINQ to SQL must be in one of the following forms:
A function wrapped as a method call having the correct mapping attributes. For more information, see Attribute-Based Mapping.
A static SQL method specific to LINQ to SQL.
A function supported by a .NET Framework method.
The topics in this section show how to form and call these methods in your application if you write the code yourself. Developers using Visual Studio would typically use the Object Relational Designer to map user-defined functions.
How to: Use Scalar-Valued User-Defined Functions
Describes how to implement a function that returns scalar values.
How to: Use Table-Valued User-Defined Functions
Describes how to implement a function that returns table values.
How to: Call User-Defined Functions Inline
Describes how to make inline calls to functions and the differences in execution when the call is made inline.