Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to #33073 - JSON columns throws Invalid token type: 'StartObject' exception with AsNoTrackingWithIdentityResolution() #33101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/EFCore.Relational/Properties/RelationalStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/EFCore.Relational/Properties/RelationalStrings.resx
Expand Up @@ -559,6 +559,15 @@
<data name="JsonNodeMustBeHandledByProviderSpecificVisitor" xml:space="preserve">
<value>This node should be handled by provider-specific sql generator.</value>
</data>
<data name="JsonProjectingCollectionElementAccessedUsingParmeterNoTrackingWithIdentityResolution" xml:space="preserve">
<value>Using parameter to access the element of a JSON collection '{entityTypeName}' is not supported for '{asNoTrackingWithIdentityResolution}'. Use constant, or project the entire JSON entity collection instead.</value>
</data>
<data name="JsonProjectingEntitiesIncorrectOrderNoTrackingWithIdentityResolution" xml:space="preserve">
<value>When using '{asNoTrackingWithIdentityResolution}' entities mapped to JSON must be projected in a particular order. Project entire collection of entities '{entityTypeName}' before its individual elements.</value>
</data>
<data name="JsonProjectingQueryableOperationNoTrackingWithIdentityResolution" xml:space="preserve">
<value>Projecting queryable operations on JSON collection is not supported for '{asNoTrackingWithIdentityResolution}'.</value>
</data>
<data name="JsonPropertyNameShouldBeConfiguredOnNestedNavigation" xml:space="preserve">
<value>The JSON property name should only be configured on nested owned navigations.</value>
</data>
Expand Down

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/EFCore/Query/QueryContext.cs
Expand Up @@ -125,10 +125,10 @@ public virtual void InitializeStateManager(bool standAlone = false)
/// </summary>
[EntityFrameworkInternal]
public virtual InternalEntityEntry? TryGetEntry(
IKey key,
object[] keyValues,
bool throwOnNullKey,
out bool hasNullKey)
IKey key,
object[] keyValues,
bool throwOnNullKey,
out bool hasNullKey)
// InitializeStateManager will populate the field before calling here
=> _stateManager!.TryGetEntry(key, keyValues, throwOnNullKey, out hasNullKey);

Expand Down
911 changes: 904 additions & 7 deletions test/EFCore.Relational.Specification.Tests/Query/JsonQueryTestBase.cs

Large diffs are not rendered by default.

Expand Up @@ -160,20 +160,20 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

public DbSet<Customer> Customers { get; set; }
public DbSet<Postcode> Postcodes { get; set; }
}

public class Customer
{
public int CustomerID { get; set; }
public string CustomerName { get; set; }
public int? PostcodeID { get; set; }
}
public class Customer
{
public int CustomerID { get; set; }
public string CustomerName { get; set; }
public int? PostcodeID { get; set; }
}

public class Postcode
{
public int PostcodeID { get; set; }
public string PostcodeValue { get; set; }
public string TownName { get; set; }
public class Postcode
{
public int PostcodeID { get; set; }
public string PostcodeValue { get; set; }
public string TownName { get; set; }
}
}

#endregion
Expand Down