Skip to content

Method calls can be used in expression trees, as long as the provider understands them #13323

@zspitz

Description

@zspitz

> if you are creating expression trees that are evaluated outside the context of the .NET common language runtime, such as in SQL Server, you should not use method calls in lambda expressions. The methods will have no meaning outside the context of the .NET common language runtime.

Depends on whether the specific provider knows how to handle that method call. For example, most providers that output SQL know what to do with the String.StartsWith method: convert to a LIKE expression.

Even void-returning method calls could theoretically be handled by the provider. For example, a call to Console.WriteLine could be converted to the SQL Server PRINT statement.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 446786

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.csharp-linq/subsvcdotnet-csharp/svcin-prThis issue will be closed (fixed) by an active pull request.okr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions