Collection change tracking for primitive collections#31480
Merged
Conversation
| { | ||
| } | ||
|
|
||
| private static bool Compare(IEnumerable<TElement>? a, IEnumerable<TElement>? b, ValueComparer<TElement> elementComparer) |
Member
There was a problem hiding this comment.
To be compatible with compiled models these methods need to be public.
Member
There was a problem hiding this comment.
Also, they shouldn't use captured variables. Instead, in-line the element comparer.
Contributor
Author
There was a problem hiding this comment.
Let's leave this for RC2. I can see it fails with compiled models, but I can't see the path forward where we can get the element comparer without capturing it in some way. Will file an issue. We can discuss.
System.NotSupportedException
Encountered a constant of unsupported type '<>c__DisplayClass0_0'. Only primitive constant nodes are supported.
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.<VisitConstant>g__GenerateValue|36_0(Object value, <>c__DisplayClass36_0&) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 949
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitConstant(ConstantExpression constant) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 878
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Translate[T](Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 158
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitMember(MemberExpression member) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 1350
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Translate[T](Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 158
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateList(IReadOnlyList`1 list) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 2175
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateMethodArguments(ParameterInfo[] parameters, IReadOnlyList`1 arguments) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 2135
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitMethodCall(MethodCallExpression call) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 1393
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Translate(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 145
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.VisitLambda[T](Expression`1 lambda) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 1228
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.Visit(Expression node) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 204
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateCore(Expression node, ISet`1 collectedNamespaces, Boolean statementContext) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 117
at Microsoft.EntityFrameworkCore.Query.Internal.LinqToCSharpSyntaxTranslator.TranslateExpression(Expression node, ISet`1 collectedNamespaces) in C:\github\efcore\src\EFCore.Design\Query\Internal\LinqToCSharpSyntaxTranslator.cs:line 101
at Microsoft.EntityFrameworkCore.Design.Internal.CSharpHelper.Expression(Expression node, ISet`1 collectedNamespaces) in C:\github\efcore\src\EFCore.Design\Design\Internal\CSharpHelper.cs:line 1545
at Microsoft.EntityFrameworkCore.Design.Internal.CSharpRuntimeAnnotationCodeGenerator.Create(ValueComparer comparer, CSharpRuntimeAnnotationCodeGeneratorParameters parameters, ICSharpHelper codeHelper) in C:\github\efcore\src\EFCore\Design\Internal\CSharpRuntimeAnnotationCodeGenerator.cs:line 394
at Microsoft.EntityFrameworkCore.Design.Internal.RelationalCSharpRuntimeAnnotationCodeGenerator.Create(CoreTypeMapping typeMapping, CSharpRuntimeAnnotationCodeGeneratorParameters parameters, ValueComparer valueComparer, ValueComparer keyValueComparer, ValueComparer providerValueComparer) in C:\github\efcore\src\EFCore.Relational\Design\Internal\RelationalCSharpRuntimeAnnotationCodeGenerator.cs:line 2128
at Microsoft.EntityFrameworkCore.Design.Internal.ICSharpRuntimeAnnotationCodeGenerator.Create(CoreTypeMapping typeMapping, IProperty property, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) in C:\github\efcore\src\EFCore\Design\Internal\ICSharpRuntimeAnnotationCodeGenerator.cs:line 117
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.Create(IProperty property, String variableName, Dictionary`2 propertyVariables, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 861
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.Create(IProperty property, Dictionary`2 propertyVariables, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 690
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.CreateEntityType(IEntityType entityType, IndentedStringBuilder mainBuilder, IndentedStringBuilder methodBuilder, SortedSet`1 namespaces, String className, Boolean nullable) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 540
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.GenerateEntityType(IEntityType entityType, String namespace, String className, Boolean nullable) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 462
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGenerator.GenerateModel(IModel model, CompiledModelCodeGenerationOptions options) in C:\github\efcore\src\EFCore.Design\Scaffolding\Internal\CSharpRuntimeModelCodeGenerator.cs:line 75
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest.Test(DbContext context, CompiledModelCodeGenerationOptions options, Action`1 assertScaffold, Action`1 assertModel, Type additionalDesignTimeServices, Action`1 useContext, String expectedExceptionMessage) in C:\github\efcore\test\EFCore.Design.Tests\Scaffolding\Internal\CSharpRuntimeModelCodeGeneratorTest.cs:line 12338
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpRuntimeModelCodeGeneratorTest.BigModel_with_JSON_columns() in C:\github\efcore\test\EFCore.Design.Tests\Scaffolding\Internal\CSharpRuntimeModelCodeGeneratorTest.cs:line 4439
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
| /// </para> | ||
| /// </remarks> | ||
| /// <typeparam name="TElement">The element type.</typeparam> | ||
| public sealed class ListComparer<TElement> : ValueComparer<IEnumerable<TElement>> |
Member
There was a problem hiding this comment.
Can this replace the equivalent one in Cosmos?
AndriySvyryd
approved these changes
Aug 16, 2023
Member
AndriySvyryd
left a comment
There was a problem hiding this comment.
Make sure there's a compiled model test with a primitive collection
Contributor
Author
|
/cc @danmoseley |
812d6c8 to
47800f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #25364