Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/EFCore.Cosmos.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"Member": "CosmosDbContextOptionsBuilder(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder);"
},
{
"Member": "virtual Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder BulkExecutionEnabled(bool enabled = true);"
"Member": "virtual Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder BulkExecutionAllowed(bool enabled = true);"
},
{
"Member": "virtual Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder ConnectionMode(Microsoft.Azure.Cosmos.ConnectionMode connectionMode);"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ public virtual CosmosDbContextOptionsBuilder SessionTokenManagementMode(SessionT
/// <see href="https://aka.ms/efcore-docs-cosmos">Accessing Azure Cosmos DB with EF Core</see> for more information and examples.
/// </remarks>
/// <param name="enabled"><see langword="true" /> to enable the Cosmos DB SDK bulk feature.</param>
public virtual CosmosDbContextOptionsBuilder BulkExecutionEnabled(bool enabled = true)
=> WithOption(e => e.BulkExecutionEnabled(enabled));
public virtual CosmosDbContextOptionsBuilder BulkExecutionAllowed(bool enabled = true)
=> WithOption(e => e.BulkExecutionAllowed(enabled));

/// <summary>
/// Sets an option by cloning the extension used to store the settings. This ensures the builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ public virtual CosmosOptionsExtension WithSessionTokenManagementMode(SessionToke
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual CosmosOptionsExtension BulkExecutionEnabled(bool enabled)
public virtual CosmosOptionsExtension BulkExecutionAllowed(bool enabled)
{
var clone = Clone();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public override string GenerateSnapshot(
.AppendLine("// If you encounter a merge conflict in the line below, it means you need to")
.AppendLine("// discard one of the migration branches and recreate its migrations on top of")
.AppendLine("// the other branch. See https://aka.ms/efcore-docs-migrations-conflicts for more info.")
.Append("public override string LatestMigrationId => ").Append(Code.Literal(latestMigrationId)).AppendLine(";")
.Append("public override string LastMigrationId => ").Append(Code.Literal(latestMigrationId)).AppendLine(";")
.AppendLine();
}

Expand Down
28 changes: 14 additions & 14 deletions src/EFCore.Relational/EFCore.Relational.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@
"Member": "virtual bool IsWrite { get; set; }"
},
{
"Member": "virtual Microsoft.EntityFrameworkCore.Infrastructure.JsonPath? JsonPath { get; }"
"Member": "virtual Microsoft.EntityFrameworkCore.Infrastructure.StructuredJsonPath? JsonPath { get; }"
},
{
"Member": "virtual string? OriginalParameterName { get; }"
Expand Down Expand Up @@ -994,7 +994,7 @@
"Member": "ColumnModificationParameters(Microsoft.EntityFrameworkCore.Update.IUpdateEntry? entry, Microsoft.EntityFrameworkCore.Metadata.IProperty? property, Microsoft.EntityFrameworkCore.Metadata.IColumnBase column, System.Func<string> generateParameterName, Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping typeMapping, bool valueIsRead, bool valueIsWrite, bool columnIsKey, bool columnIsCondition, bool sensitiveLoggingEnabled);"
},
{
"Member": "ColumnModificationParameters(string columnName, object? value, Microsoft.EntityFrameworkCore.Metadata.IProperty? property, string? columnType, Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping? typeMapping, Microsoft.EntityFrameworkCore.Infrastructure.JsonPath jsonPath, bool read, bool write, bool key, bool condition, bool sensitiveLoggingEnabled, bool? isNullable = null);"
"Member": "ColumnModificationParameters(string columnName, object? value, Microsoft.EntityFrameworkCore.Metadata.IProperty? property, string? columnType, Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping? typeMapping, Microsoft.EntityFrameworkCore.Infrastructure.StructuredJsonPath jsonPath, bool read, bool write, bool key, bool condition, bool sensitiveLoggingEnabled, bool? isNullable = null);"
},
{
"Member": "ColumnModificationParameters();"
Expand Down Expand Up @@ -1050,7 +1050,7 @@
"Member": "bool IsWrite { get; init; }"
},
{
"Member": "Microsoft.EntityFrameworkCore.Infrastructure.JsonPath? JsonPath { get; init; }"
"Member": "Microsoft.EntityFrameworkCore.Infrastructure.StructuredJsonPath? JsonPath { get; init; }"
},
{
"Member": "object? OriginalValue { get; init; }"
Expand Down Expand Up @@ -3594,7 +3594,7 @@
"Member": "bool IsWrite { get; set; }"
},
{
"Member": "Microsoft.EntityFrameworkCore.Infrastructure.JsonPath? JsonPath { get; }"
"Member": "Microsoft.EntityFrameworkCore.Infrastructure.StructuredJsonPath? JsonPath { get; }"
},
{
"Member": "string? OriginalParameterName { get; }"
Expand Down Expand Up @@ -6209,7 +6209,7 @@
"Member": "Microsoft.EntityFrameworkCore.Metadata.IRelationalJsonElement? ParentElement { get; }"
},
{
"Member": "System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Infrastructure.JsonPathSegment> Path { get; }"
"Member": "System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.StructuredJsonPathSegment> Path { get; }"
},
{
"Member": "System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IJsonElementMapping> PropertyMappings { get; }"
Expand Down Expand Up @@ -7326,10 +7326,10 @@
]
},
{
"Type": "class Microsoft.EntityFrameworkCore.Infrastructure.JsonPath",
"Type": "class Microsoft.EntityFrameworkCore.Infrastructure.StructuredJsonPath",
"Methods": [
{
"Member": "JsonPath(System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Infrastructure.JsonPathSegment> segments, int[] ordinals);"
"Member": "StructuredJsonPath(System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.StructuredJsonPathSegment> segments, int[] indices);"
},
{
"Member": "virtual System.Text.StringBuilder AppendTo(System.Text.StringBuilder builder);"
Expand All @@ -7343,29 +7343,29 @@
"Member": "virtual bool IsRoot { get; }"
},
{
"Member": "virtual int[] Ordinals { get; }"
"Member": "virtual int[] Indices { get; }"
},
{
"Member": "static Microsoft.EntityFrameworkCore.Infrastructure.JsonPath Root { get; }"
"Member": "static Microsoft.EntityFrameworkCore.Infrastructure.StructuredJsonPath Root { get; }"
},
{
"Member": "virtual System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Infrastructure.JsonPathSegment> Segments { get; }"
"Member": "virtual System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.StructuredJsonPathSegment> Segments { get; }"
}
]
},
{
"Type": "sealed class Microsoft.EntityFrameworkCore.Infrastructure.JsonPathSegment",
"Type": "sealed class Microsoft.EntityFrameworkCore.Metadata.StructuredJsonPathSegment",
"Methods": [
{
"Member": "JsonPathSegment(string propertyName);"
"Member": "StructuredJsonPathSegment(string propertyName);"
},
{
"Member": "override string ToString();"
}
],
"Properties": [
{
"Member": "static Microsoft.EntityFrameworkCore.Infrastructure.JsonPathSegment Array { get; }"
"Member": "static Microsoft.EntityFrameworkCore.Metadata.StructuredJsonPathSegment Array { get; }"
},
{
"Member": "bool IsArray { get; }"
Expand Down Expand Up @@ -8466,7 +8466,7 @@
],
"Properties": [
{
"Member": "virtual string? LatestMigrationId { get; }"
"Member": "virtual string? LastMigrationId { get; }"
},
{
"Member": "virtual Microsoft.EntityFrameworkCore.Metadata.IModel Model { get; }"
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Infrastructure/ModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public virtual IModel Model
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-migrations-conflicts">Database migrations</see> for more information and examples.
/// </remarks>
public virtual string? LatestMigrationId
public virtual string? LastMigrationId
=> null;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,56 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text;
using Microsoft.EntityFrameworkCore.Metadata;

namespace Microsoft.EntityFrameworkCore.Infrastructure;

/// <summary>
/// Represents a structured JSON path consisting of property name segments and array index placeholders,
/// along with runtime ordinal values for array positions.
/// along with runtime index values for array positions.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information and examples.
/// </remarks>
public class JsonPath
public class StructuredJsonPath
{
/// <summary>
/// A <see cref="JsonPath" /> representing the root of a JSON document (<c>$</c>).
/// A <see cref="StructuredJsonPath" /> representing the root of a JSON document (<c>$</c>).
/// </summary>
public static JsonPath Root { get; } = new([], []);
public static StructuredJsonPath Root { get; } = new([], []);

/// <summary>
/// Creates a new <see cref="JsonPath" /> instance.
/// Creates a new <see cref="StructuredJsonPath" /> instance.
/// </summary>
/// <param name="segments">The path segments.</param>
/// <param name="ordinals">
/// The ordinal values for array index placeholders. Must have one entry for each segment
/// where <see cref="JsonPathSegment.IsArray" /> is <see langword="true" />.
/// <param name="indices">
/// The index values for array index placeholders. Must have one entry for each segment
/// where <see cref="StructuredJsonPathSegment.IsArray" /> is <see langword="true" />.
/// </param>
public JsonPath(IReadOnlyList<JsonPathSegment> segments, int[] ordinals)
public StructuredJsonPath(IReadOnlyList<StructuredJsonPathSegment> segments, int[] indices)
{
var arraySegmentCount = segments.Count(s => s.IsArray);
if (ordinals.Length != arraySegmentCount)
if (indices.Length != arraySegmentCount)
{
throw new ArgumentException(
CoreStrings.InvalidJsonPathOrdinalCount(ordinals.Length, arraySegmentCount),
nameof(ordinals));
CoreStrings.InvalidStructuredJsonPathIndexCount(indices.Length, arraySegmentCount),
nameof(indices));
}

Segments = segments;
Ordinals = ordinals;
Indices = indices;
}

/// <summary>
/// Gets the path segments.
/// </summary>
public virtual IReadOnlyList<JsonPathSegment> Segments { get; }
public virtual IReadOnlyList<StructuredJsonPathSegment> Segments { get; }

/// <summary>
/// Gets the ordinal values for array index placeholders. The ordinals are applied in order
/// to the segments where <see cref="JsonPathSegment.IsArray" /> is <see langword="true" />.
/// Gets the index values for array index placeholders. The indices are applied in order
/// to the segments where <see cref="StructuredJsonPathSegment.IsArray" /> is <see langword="true" />.
/// </summary>
public virtual int[] Ordinals { get; }
public virtual int[] Indices { get; }

/// <summary>
/// Gets a value indicating whether this path represents the root of a JSON document (<c>$</c>).
Expand All @@ -67,13 +68,13 @@ public virtual StringBuilder AppendTo(StringBuilder builder)
{
builder.Append('$');

var ordinalIndex = 0;
var indexPosition = 0;
foreach (var segment in Segments)
{
if (segment.IsArray)
{
builder.Append('[');
builder.Append(Ordinals[ordinalIndex++]);
builder.Append(Indices[indexPosition++]);
builder.Append(']');
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Metadata/IRelationalJsonElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IRelationalJsonElement
/// <summary>
/// Gets the path segments from the root of the JSON document to this element.
/// </summary>
IReadOnlyList<JsonPathSegment> Path { get; }
IReadOnlyList<StructuredJsonPathSegment> Path { get; }

/// <summary>
/// Gets the parent element, or <see langword="null" /> if this is a root element.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected RelationalJsonElement(
bool isNullable)
{
ContainingColumn = parentElement.ContainingColumn;
Path = [.. parentElement.Path, JsonPathSegment.Array];
Path = [.. parentElement.Path, StructuredJsonPathSegment.Array];
ParentElement = parentElement;
IsNullable = isNullable;
}
Expand All @@ -73,7 +73,7 @@ public virtual RelationalTypeMapping? StoreTypeMapping
=> GetDefaultStoreTypeMapping();

/// <inheritdoc />
public virtual IReadOnlyList<JsonPathSegment> Path { get; protected set; }
public virtual IReadOnlyList<StructuredJsonPathSegment> Path { get; protected set; }

/// <inheritdoc />
public virtual IRelationalJsonElement? ParentElement { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public RelationalJsonObject(
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IReadOnlyList<JsonPathSegment> CreateChildPath(string childName)
public virtual IReadOnlyList<StructuredJsonPathSegment> CreateChildPath(string childName)
{
var path = new JsonPathSegment[Path.Count + 1];
var path = new StructuredJsonPathSegment[Path.Count + 1];
for (var i = 0; i < Path.Count; i++)
{
path[i] = Path[i];
}

path[^1] = new JsonPathSegment(childName);
path[^1] = new StructuredJsonPathSegment(childName);
return path;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.EntityFrameworkCore.Infrastructure;
namespace Microsoft.EntityFrameworkCore.Metadata;

/// <summary>
/// Represents a single segment in a JSON path. A segment is either a property name or an array index placeholder.
/// </summary>
/// <remarks>
/// See <see href="https://aka.ms/efcore-docs-modeling">Modeling entity types and relationships</see> for more information and examples.
/// </remarks>
public sealed class JsonPathSegment
public sealed class StructuredJsonPathSegment
{
/// <summary>
/// Creates a new <see cref="JsonPathSegment" /> for a named property.
/// Creates a new <see cref="StructuredJsonPathSegment" /> for a named property.
/// </summary>
/// <param name="propertyName">The JSON property name.</param>
public JsonPathSegment(string propertyName)
public StructuredJsonPathSegment(string propertyName)
{
Check.NotEmpty(propertyName, nameof(propertyName));

PropertyName = propertyName;
IsArray = false;
}

private JsonPathSegment(bool isArray)
private StructuredJsonPathSegment(bool isArray)
{
PropertyName = null;
IsArray = isArray;
}

/// <summary>
/// Creates a new <see cref="JsonPathSegment" /> for an array index placeholder.
/// Creates a new <see cref="StructuredJsonPathSegment" /> for an array index placeholder.
/// </summary>
/// <returns>A new array index placeholder segment.</returns>
public static JsonPathSegment Array { get; } = new(isArray: true);
public static StructuredJsonPathSegment Array { get; } = new(isArray: true);

/// <summary>
/// Gets the JSON property name. <see langword="null" /> for array index placeholder segments.
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Update/ColumnModification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public static bool IsStoreGenerated(IUpdateEntry entry, IProperty property)
=> entry.IsStoreGenerated(property);

/// <inheritdoc />
public virtual JsonPath? JsonPath { get; }
public virtual StructuredJsonPath? JsonPath { get; }

/// <inheritdoc />
public virtual void AddSharedColumnModification(IColumnModification modification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public readonly record struct ColumnModificationParameters
/// <summary>
/// In case of JSON column modification, the JSON path leading to the JSON element that needs to be updated.
/// </summary>
public JsonPath? JsonPath { get; init; }
public StructuredJsonPath? JsonPath { get; init; }

/// <summary>
/// Creates a new <see cref="ColumnModificationParameters" /> instance.
Expand Down Expand Up @@ -259,7 +259,7 @@ public ColumnModificationParameters(
IProperty? property,
string? columnType,
RelationalTypeMapping? typeMapping,
JsonPath jsonPath,
StructuredJsonPath jsonPath,
bool read,
bool write,
bool key,
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Update/IColumnModification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public interface IColumnModification
/// <summary>
/// In case of JSON column modification, the JSON path leading to the JSON element that needs to be updated.
/// </summary>
public JsonPath? JsonPath { get; }
public StructuredJsonPath? JsonPath { get; }

/// <summary>
/// Adds a modification affecting the same database value.
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore.Relational/Update/ModificationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,11 @@ void HandleJson(List<IColumnModification> columnModifications)
// FindCommonJsonPartialUpdateInfo may have reduced the update to a common ancestor
// that has fewer array levels than the originally collected ordinals.
var arraySegmentCount = pathSegments.Count(s => s.IsArray);
var ordinalsArray = ordinals.Count > arraySegmentCount
var indicesArray = ordinals.Count > arraySegmentCount
? ordinals.GetRange(0, arraySegmentCount).ToArray()
: ordinals.ToArray();

var jsonPath = new JsonPath(pathSegments, ordinalsArray);
var jsonPath = new StructuredJsonPath(pathSegments, indicesArray);
if (jsonProperty is IProperty property)
{
var columnModificationParameters = new ColumnModificationParameters(
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/Diagnostics/CoreLoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private static string CompiledModelProviderMismatch(EventDefinitionBase definiti
{
var d = (EventDefinition<string, string>)definition;
var p = (ProviderMismatchEventData)payload;
return d.GenerateMessage(p.CompiledProviderName, p.CurrentProviderName);
return d.GenerateMessage(p.MismatchedProviderName, p.CurrentProviderName);
}

/// <summary>
Expand Down
Loading
Loading