Query: Additional function mapping capabilities

Open
#4,319 17 comments 19 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp
Domain
databases

Research direction

This is an umbrella issue covering several database-function mapping capabilities rather than one scoped change. Start by reviewing the unchecked linked issues, including #13239, #20093, #9810, #20363, #11850, #20052, and #19970, to identify a specific task. Done would require completing one capability and marking the corresponding item resolved.

Written by the indexing model from the issue text.

Description

area-query area-relational-mapping composite-issue

This would allow functions in the database to be used in LINQ queries. This includes:

  • Collection-valued composable functions, such as TVFs in SQL Server (#20051)
  • Composable functions with table valued parameters (#13239)
    • Support queries with complex expressions in parameters (#20093)
  • Scalar composable functions (addressed by #7368)
  • Scalar collection composable functions (#9810, #20363)
  • User-defined aggregate functions (#11850, #20052)
  • #31871

We could support a number of patterns for this:

  • Map functions to CLR methods (addressed by #9755)
    • Using fluent API
    • Using an attribute
  • Ad-hoc invocation of SQL fragment in LINQ queries
  • Map entity types to functions without a stand-in method
    • Support complex entity type to function mapping (#19970)
    • Map properties to functions, e.g. enable entities to have calculated properties that evaluate to calling a function with the entity key as the argument
    • Map navigations to functions

Once database functions can be mapped to methods, we could accept those methods in other places besides LINQ queries, e.g. to specify default values, in set based updates (once we have the feature), etc.

Dominant language
C#
Stars
14.8k
Forks
3.4k
Avg merge
2d 5h
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.