Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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.

  • 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. Object Relational Designer (O/R Designer)
Object Relational Designer (O/R Designer)

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.