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

[automated] Merge branch 'release/9.0' => 'main' #35256

Merged
merged 25 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bd7d0aa
Add missing awaits in MigrationsInfrastructureTestBase (#35107)
roji Nov 14, 2024
1a71476
[release/9.0] Update dependencies from dotnet/arcade (#35199)
dotnet-maestro[bot] Nov 26, 2024
a8c7b9d
Fix TPC equality check inside subquery predicate (#35120) (#35201)
roji Nov 26, 2024
fa4ce99
Add missing Converts when simplifying in funcletizer (#35122) (#35202)
roji Nov 26, 2024
3695bca
Correct VisitUnary operand evaluation in funcletizer (#35172) (#35203)
roji Nov 26, 2024
1a69d23
Fix to #35206 - Query/Perf: don't use Invoke in value comparer lambda…
maumar Nov 27, 2024
b50581a
Fix to #35208 (#35211)
maumar Nov 27, 2024
08b4d43
[release/9.0] Enable Cosmos vector search on EF9 (#35183)
ajcvickers Nov 27, 2024
59e92ae
[release/9.0] Return null when the type is nullable for Cosmos Max/Mi…
ajcvickers Nov 27, 2024
b7a436f
Fix to #35212 - Query/Perf: Compile identifier lambdas passed to Popu…
maumar Nov 27, 2024
1c0ef32
[release/9.0] Uniquify all variables used in SQL Server migration scr…
AndriySvyryd Dec 2, 2024
fba8789
Avoid using `^` and `~` when invalid because of value converters (#35…
roji Dec 2, 2024
cc53f41
[release/9.0] Prevent owner entity from becoming optional (#35222)
AndriySvyryd Dec 2, 2024
017e8dc
[release/9.0] Set environment variables to "Development" when creatin…
AndriySvyryd Dec 2, 2024
d89ec3f
[release/9.0] Fix query filters with context accessors (#35246)
cincuranet Dec 2, 2024
507152b
[release/9.0] Add more specific messages when pending model changes a…
AndriySvyryd Dec 2, 2024
6489581
[release/9.0] Fix Contains on ImmutableArray (#35251)
cincuranet Dec 2, 2024
8741e71
Merge branch 'release/9.0-staging' into release/9.0
AndriySvyryd Dec 2, 2024
bb72406
Merge branch 'release/9.0-staging' into release/9.0 (#35255)
AndriySvyryd Dec 2, 2024
aed754c
Expose SQLite VFS option in connection string (#34864)
arontsang Dec 3, 2024
ac5bd7b
Allow SqlFragmentExpression to have a type/type mapping (#34995)
roji Dec 4, 2024
7937010
Don't suppress transactions when creating the history repository (#35…
AndriySvyryd Dec 4, 2024
20849ed
See how SqlClient 6 runs (#35232)
ErikEJ Dec 4, 2024
093d4a1
Update instruction for daily builds to 10. (#35274)
cincuranet Dec 5, 2024
cbd1552
Merge branch 'release/9.0'
AndriySvyryd Dec 6, 2024
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 Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.46.0" />

<!-- SQL Server dependencies -->
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="6.0.0-preview3.24332.3" />
<PackageVersion Include="Microsoft.SqlServer.Types" Version="160.1000.6" />

<!-- external dependencies -->
Expand Down
20 changes: 10 additions & 10 deletions docs/DailyBuilds.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Create a file called "NuGet.config" with the following contents and put it next
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Expand Down Expand Up @@ -36,7 +36,7 @@ For EF8 daily builds, `NuGet.config` should contain:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Expand All @@ -47,15 +47,15 @@ For EF8 daily builds, `NuGet.config` should contain:
`dotnet ef` is the [the EF command-line tool](https://learn.microsoft.com/ef/core/cli/dotnet), used to perform various design-time tasks such as creating and applying migrations. Stable versions of `dotnet ef` usually work fine with daily build versions of EF; but in some situations you must also update to daily builds of the CLI tool. To use a daily build version of `dotnet ef`, do the following:

```sh
dotnet tool install -g dotnet-ef --version 9.0.0-* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
dotnet tool install -g dotnet-ef --version 10.0.0-* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json
```

### EF reverse engineering templates

EF features code templates for [reverse engineering (or "scaffolding") existing databases](https://learn.microsoft.com/ef/core/managing-schemas/scaffolding/templates); installing daily versions of these templates typically isn't necessary, but you may want to do so to experiment with new features or test bug fixes in the templates:

```sh
dotnet new install Microsoft.EntityFrameworkCore.Templates::9.0.0-* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
dotnet new install Microsoft.EntityFrameworkCore.Templates::10.0.0-* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json
```

## Package versions to use
Expand All @@ -66,10 +66,10 @@ The easiest way to use daily builds is with wildcards in project references. For

```xml
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="9.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="10.0.0-*" />
</ItemGroup>
```

Expand Down Expand Up @@ -112,7 +112,7 @@ In addition, packages may be missing if the standard `nuget.org` package source
<clear />
</disabledPackageSources>
<packageSources>
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Expand All @@ -128,7 +128,7 @@ A good way to ensure you're dealing with a completely clean NuGet configuration
</disabledPackageSources>
<packageSources>
<clear />
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.EntityFrameworkCore.Cosmos.Internal;
Expand Down Expand Up @@ -832,7 +832,7 @@ protected override ShapedQueryExpression TranslateCast(ShapedQueryExpression sou
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
protected override ShapedQueryExpression? TranslateMin(ShapedQueryExpression source, LambdaExpression? selector, Type resultType)
=> TranslateAggregate(source, selector, resultType, "MIN");
=> TranslateAggregate(source, selector, resultType, "MIN");

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down
17 changes: 0 additions & 17 deletions src/EFCore.Design/Design/Internal/AppServiceProviderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,6 @@ public virtual IServiceProvider Create(string[] args)
return null;
}

var aspnetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
var dotnetEnvironment = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT");
var environment = aspnetCoreEnvironment
?? dotnetEnvironment
?? "Development";
if (aspnetCoreEnvironment == null)
{
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", environment);
}

if (dotnetEnvironment == null)
{
Environment.SetEnvironmentVariable("DOTNET_ENVIRONMENT", environment);
}

_reporter.WriteVerbose(DesignStrings.UsingEnvironment(environment));

try
{
var services = serviceProviderFactory(args);
Expand Down
17 changes: 17 additions & 0 deletions src/EFCore.Design/Design/Internal/DbContextOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,23 @@ private IDictionary<Type, Func<DbContext>> FindContextTypes(string? name = null,
{
_reporter.WriteVerbose(DesignStrings.FindingContexts);

var aspnetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
var dotnetEnvironment = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT");
var environment = aspnetCoreEnvironment
?? dotnetEnvironment
?? "Development";
if (aspnetCoreEnvironment == null)
{
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", environment);
}

if (dotnetEnvironment == null)
{
Environment.SetEnvironmentVariable("DOTNET_ENVIRONMENT", environment);
}

_reporter.WriteVerbose(DesignStrings.UsingEnvironment(environment));

var contexts = new Dictionary<Type, Func<DbContext>?>();

try
Expand Down
14 changes: 14 additions & 0 deletions src/EFCore.Relational/Diagnostics/RelationalEventId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private enum Id
NonTransactionalMigrationOperationWarning,
AcquiringMigrationLock,
MigrationsUserTransactionWarning,
ModelSnapshotNotFound,

// Query events
QueryClientEvaluationWarning = CoreEventId.RelationalBaseId + 500,
Expand Down Expand Up @@ -778,6 +779,19 @@ private static EventId MakeMigrationsId(Id id)
/// </remarks>
public static readonly EventId MigrationsUserTransactionWarning = MakeMigrationsId(Id.MigrationsUserTransactionWarning);

/// <summary>
/// Model snapshot was not found.
/// </summary>
/// <remarks>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Migrations" /> category.
/// </para>
/// <para>
/// This event uses the <see cref="MigrationAssemblyEventData" /> payload when used with a <see cref="DiagnosticSource" />.
/// </para>
/// </remarks>
public static readonly EventId ModelSnapshotNotFound = MakeMigrationsId(Id.ModelSnapshotNotFound);

private static readonly string _queryPrefix = DbLoggerCategory.Query.Name + ".";

private static EventId MakeQueryId(Id id)
Expand Down
71 changes: 71 additions & 0 deletions src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,77 @@ private static string PendingModelChanges(EventDefinitionBase definition, EventD
return d.GenerateMessage(p.ContextType.ShortDisplayName());
}

/// <summary>
/// Logs for the <see cref="RelationalEventId.PendingModelChangesWarning" /> event.
/// </summary>
/// <param name="diagnostics">The diagnostics logger to use.</param>
/// <param name="contextType">The <see cref="DbContext" /> type being used.</param>
public static void NonDeterministicModel(
this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics,
Type contextType)
{
var definition = RelationalResources.LogNonDeterministicModel(diagnostics);

if (diagnostics.ShouldLog(definition))
{
definition.Log(diagnostics, contextType.ShortDisplayName());
}

if (diagnostics.NeedsEventData(definition, out var diagnosticSourceEnabled, out var simpleLogEnabled))
{
var eventData = new DbContextTypeEventData(
definition,
NonDeterministicModel,
contextType);

diagnostics.DispatchEventData(definition, eventData, diagnosticSourceEnabled, simpleLogEnabled);
}
}

private static string NonDeterministicModel(EventDefinitionBase definition, EventData payload)
{
var d = (EventDefinition<string>)definition;
var p = (DbContextTypeEventData)payload;
return d.GenerateMessage(p.ContextType.ShortDisplayName());
}

/// <summary>
/// Logs for the <see cref="RelationalEventId.MigrationsNotFound" /> event.
/// </summary>
/// <param name="diagnostics">The diagnostics logger to use.</param>
/// <param name="migrator">The migrator.</param>
/// <param name="migrationsAssembly">The assembly in which migrations are stored.</param>
public static void ModelSnapshotNotFound(
this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics,
IMigrator migrator,
IMigrationsAssembly migrationsAssembly)
{
var definition = RelationalResources.LogNoModelSnapshotFound(diagnostics);

if (diagnostics.ShouldLog(definition))
{
definition.Log(diagnostics, migrationsAssembly.Assembly.GetName().Name!);
}

if (diagnostics.NeedsEventData(definition, out var diagnosticSourceEnabled, out var simpleLogEnabled))
{
var eventData = new MigrationAssemblyEventData(
definition,
ModelSnapshotNotFound,
migrator,
migrationsAssembly);

diagnostics.DispatchEventData(definition, eventData, diagnosticSourceEnabled, simpleLogEnabled);
}
}

private static string ModelSnapshotNotFound(EventDefinitionBase definition, EventData payload)
{
var d = (EventDefinition<string>)definition;
var p = (MigrationAssemblyEventData)payload;
return d.GenerateMessage(p.MigrationsAssembly.Assembly.GetName().Name!);
}

/// <summary>
/// Logs for the <see cref="RelationalEventId.NonTransactionalMigrationOperationWarning" /> event.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,24 @@ public abstract class RelationalLoggingDefinitions : LoggingDefinitions
[EntityFrameworkInternal]
public EventDefinitionBase? LogPendingModelChanges;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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>
[EntityFrameworkInternal]
public EventDefinitionBase? LogNonDeterministicModel;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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>
[EntityFrameworkInternal]
public EventDefinitionBase? LogNoModelSnapshotFound;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
3 changes: 1 addition & 2 deletions src/EFCore.Relational/Migrations/HistoryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ async Task<bool> IHistoryRepository.CreateIfNotExistsAsync(CancellationToken can
private IReadOnlyList<MigrationCommand> GetCreateIfNotExistsCommands()
=> Dependencies.MigrationsSqlGenerator.Generate([new SqlOperation
{
Sql = GetCreateIfNotExistsScript(),
SuppressTransaction = true
Sql = GetCreateIfNotExistsScript()
}]);

/// <summary>
Expand Down
Loading