Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/EFCore.Design/Properties/DesignStrings.Designer.cs

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

3 changes: 0 additions & 3 deletions src/EFCore.Design/Properties/DesignStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ Change your target project to the migrations project by using the Package Manage
<data name="MSBuildWorkspaceFailure" xml:space="preserve">
<value>MSBuild Workspace failure: {kind} - {message}</value>
</data>
<data name="MultipleAnnotationConflict" xml:space="preserve">
<value>The annotation '{annotationName}' was specified twice with potentially different values. Specifying the same annotation multiple times for different providers is no longer supported. Review the generated Migration to ensure it is correct and, if necessary, edit the Migration to fix any issues.</value>
</data>
<data name="MultipleContexts" xml:space="preserve">
<value>More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore.Relational/EFCore.Relational.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -16710,6 +16710,9 @@
{
"Member": "static string ModificationCommandInvalidEntityStateSensitive(object? entityType, object? keyValues, object? entityState);"
},
{
"Member": "static string MultipleAnnotationConflict(object? annotationName);"
},
{
"Member": "static string MultipleColumnsWithSameJsonContainerName(object? entityType, object? columnName);"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.EntityFrameworkCore.Design.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

Expand Down Expand Up @@ -52,8 +53,10 @@ public SnapshotModelProcessor(
public virtual IModel? Process(IReadOnlyModel? model, bool resetVersion = false)
{
if (model == null
#pragma warning disable EF1001 // Internal EF Core API usage.
|| model is not Model mutableModel
|| mutableModel.IsReadOnly)
#pragma warning restore EF1001 // Internal EF Core API usage.
{
return null;
}
Expand Down Expand Up @@ -85,7 +88,9 @@ public SnapshotModelProcessor(
mutableModel.RemoveAnnotation("ChangeDetector.SkipDetectChanges");
if (resetVersion)
{
#pragma warning disable EF1001 // Internal EF Core API usage.
mutableModel.SetProductVersion(ProductInfo.GetVersion());
#pragma warning restore EF1001 // Internal EF Core API usage.
}

return _modelRuntimeInitializer.Initialize((IModel)model, designTime: true, validationLogger: null);
Expand Down Expand Up @@ -117,7 +122,7 @@ private void ProcessComplexProperties(IReadOnlyTypeBase typeBase, string version
foreach (var complexProperty in typeBase.GetComplexProperties())
{
ProcessElement(complexProperty, version);

if (complexProperty is IMutableComplexProperty mutableComplexProperty)
{
UpdateComplexPropertyNullability(mutableComplexProperty, version);
Expand Down Expand Up @@ -160,7 +165,7 @@ private void ProcessElement(IReadOnlyAnnotatable? metadata, string version)
else if (!Equals(duplicate.Value, annotation.Value))
{
_operationReporter.WriteWarning(
DesignStrings.MultipleAnnotationConflict(stripped[1..]));
RelationalStrings.MultipleAnnotationConflict(stripped[1..]));
}
}
}
Expand Down

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

3 changes: 3 additions & 0 deletions src/EFCore.Relational/Properties/RelationalStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,9 @@
<data name="ModificationCommandInvalidEntityStateSensitive" xml:space="preserve">
<value>Cannot save changes for an entity of type '{entityType}' with primary key values {keyValues} in state '{entityState}'. This may indicate a bug in Entity Framework, file an issue at https://aka.ms/efcorefeedback.</value>
</data>
<data name="MultipleAnnotationConflict" xml:space="preserve">
<value>The annotation '{annotationName}' was specified twice with potentially different values. Specifying the same annotation multiple times for different providers is no longer supported. Review the generated Migration to ensure it is correct and, if necessary, edit the Migration to fix any issues.</value>
</data>
<data name="MultipleColumnsWithSameJsonContainerName" xml:space="preserve">
<value>Entity type '{entityType}' is mapped to multiple columns with name '{columnName}', and one of them is configured as a JSON column. Assign different names to the columns.</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion src/ef/ef.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<Compile Include="..\EFCore.Design\Design\IOperationResultHandler.cs" />
<Compile Include="..\EFCore.Design\Design\OperationReportHandler.cs" />
<Compile Include="..\EFCore.Design\Design\OperationResultHandler.cs" />
<Compile Include="..\EFCore.Design\Design\Internal\IOperationReporter.cs" />
<Compile Include="..\EFCore.Relational\Design\Internal\IOperationReporter.cs" />
<Compile Include="..\EFCore.Design\Design\Internal\OperationReporter.cs" />
<Compile Include="..\EFCore.Relational\Internal\SemanticVersionComparer.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void Warns_for_conflicting_annotations()

var (level, message) = reporter.Messages.Single();
Assert.Equal(LogLevel.Warning, level);
Assert.Equal(DesignStrings.MultipleAnnotationConflict("DefaultSchema"), message);
Assert.Equal(RelationalStrings.MultipleAnnotationConflict("DefaultSchema"), message);
Assert.Equal(2, model.GetAnnotations().Count());

var actual = (string)model["Relational:DefaultSchema"];
Expand All @@ -112,7 +112,7 @@ public void Warns_for_conflicting_annotations_one_relational()

var (level, message) = reporter.Messages.Single();
Assert.Equal(LogLevel.Warning, level);
Assert.Equal(DesignStrings.MultipleAnnotationConflict("DefaultSchema"), message);
Assert.Equal(RelationalStrings.MultipleAnnotationConflict("DefaultSchema"), message);
Assert.Equal(2, model.GetAnnotations().Count());

var actual = (string)model["Relational:DefaultSchema"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\EFCore\EFCore.csproj" />
<ProjectReference Include="..\..\src\EFCore.Relational\EFCore.Relational.csproj" />
<ProjectReference Include="..\..\src\EFCore.Design\EFCore.Design.csproj" />
<ProjectReference Include="..\..\src\EFCore.Proxies\EFCore.Proxies.csproj" />
<ProjectReference Include="..\..\src\EFCore.Abstractions\EFCore.Abstractions.csproj" />
Expand Down
Loading