Question on possibility of general RelationalShapedQueryCompilingExpressionExpressionVisitor updates
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Read src/Shared/ExpressionExtensions.cs and src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs, focusing on the two proposed changes for handling StructuralTypeProjectionExpression and enumerable cardinality results. Check how these changes affect relational query compilation and whether they avoid patching the visitor for custom query translation and SQL generation factories. Done means deciding whether the general changes are appropriate for EF Core and defining their compatibility impact across releases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Question
While exploring the possibility of passing a custom Expression with Enumerable cardinality results
through the EFCore pipeline, it became necessary to implement some patches related to RelationalShapedQueryCompilingExpressionExpressionVisitor and ExpressionExtensions.
Take a look at code fragments marked by // ++++++++++++++++ >
Does it make sense to create PR to have such change in current and future releases in order to do not patch
RelationalShapedQueryCompilingExpressionExpressionVisitor?
According to research results it would be enough to implement only two custom IQueryableMethodTranslatingExpressionVisitorFactory and IQuerySqlGeneratorFactory with such changes.
Your code
// efcore\src\Shared\ExpressionExtensions.cs
internal static class ExpressionExtensions
{
// ...
public static T GetConstantValue<T>(this Expression expression)
=> RemoveConvert(expression) switch
{
// ++++++++++++++ >
StructuralTypeProjectionExpression projection => (T)(IReadOnlyDictionary<IProperty, ColumnExpression>)typeof(StructuralTypeProjectionExpression).GetField("_propertyExpressionMap", BindingFlags.NonPublic| BindingFlags.Instance | BindingFlags.GetField)!.GetValue(projection)!,
// ++++++++++++++ <
ConstantExpression constantExpression => (T)constantExpression.Value!,
#pragma warning disable EF9100 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
LiftableConstantExpression liftableConstantExpression => (T)liftableConstantExpression.OriginalExpression.Value!,
#pragma warning restore EF9100 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
_ => throw new InvalidOperationException()
};
// ...
}
// efcore\src\EFCore.Relational\Query\
// RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs
protected override Expression VisitBinary(BinaryExpression binaryExpression)
{
switch (binaryExpression)
{
case { NodeType: ExpressionType.Assign, Left: ParameterExpression parameterExpression }
when parameterExpression.Type == typeof(MaterializationContext):
{
var newExpression = (NewExpression)binaryExpression.Right;
if (newExpression.Arguments[0] is ProjectionBindingExpression projectionBindingExpression)
{
var propertyMap = GetProjectionIndex(projectionBindingExpression) switch
{
// ++++++++++++++++ >
IReadOnlyDictionary<IProperty, ColumnExpression> pp => pp.Select((x, i) => (x, i)).ToDictionary(x => (IPropertyBase)x.x.Key, x => x.i),
// ++++++++++++++++ <
IDictionary<IPropertyBase, int> p => p,
QueryableJsonProjectionInfo pi => pi.PropertyIndexMap,
_ => throw new UnreachableException()
};
Stack traces
Verbose output
EF Core version
10.0.0
Database provider
No response
Target framework
.NET 10
Operating system
No response
IDE
No response
- Lingua principale
- C#
- Stelle
- 14.8k
- Fork
- 3.4k
- Merge medio
- 3g 18h
- PR unite (30g)
- 159
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dotnet/efcore
-
customer-reported
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
-
Regression in 11.0: replacing an owned instance or re-adding an entity with the same key sets unchanged OnAdd properties to nullForse già presa @seragAhmed l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
dotnet/efcore#39617 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
customer-reported
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di dotnet/efcore
Issue simili
-
bug emitter:client:csharp
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/typespec#12572 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-networking
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/aspnetcore#70545 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno