User-Defined Functions (LINQ to SQL)
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 (LINQ to SQL).
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. For more information, see Object Relational Designer (O/R Designer) and Object Relational Designer (O/R Designer).