Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dotnet/efcore
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.0.3
Choose a base ref
...
head repository: dotnet/efcore
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v9.0.4
Choose a head ref
Loading
Showing with 422 additions and 155 deletions.
  1. +2 −2 NuGet.config
  2. +36 −36 eng/Version.Details.xml
  3. +17 −17 eng/Versions.props
  4. +1 −1 eng/common/core-templates/steps/generate-sbom.yml
  5. +14 −6 eng/common/generate-sbom-prep.ps1
  6. +11 −6 eng/common/generate-sbom-prep.sh
  7. +1 −0 eng/common/templates-official/job/job.yml
  8. +1 −1 eng/common/templates-official/post-build/common-variables.yml
  9. +4 −4 global.json
  10. +26 −0 src/EFCore.Design/Design/Internal/AppServiceProviderFactory.cs
  11. +3 −0 src/EFCore.Design/Design/Internal/DatabaseOperations.cs
  12. +1 −16 src/EFCore.Design/Design/Internal/DbContextOperations.cs
  13. +57 −2 src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs
  14. +79 −3 src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs
  15. +68 −2 test/EFCore.Design.Tests/Design/Internal/DatabaseOperationsTest.cs
  16. +2 −2 test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationOperationGeneratorTest.cs
  17. +0 −38 test/EFCore.Design.Tests/Scaffolding/Internal/ReverseEngineeringConfigurationTests.cs
  18. +0 −16 test/EFCore.Design.Tests/TestUtilities/TestDatabaseOperations.cs
  19. +17 −0 test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs
  20. +14 −0 test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs
  21. +20 −0 test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs
  22. +17 −0 test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs
  23. +14 −0 test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs
  24. +14 −0 test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs
  25. +1 −1 test/EFCore.Tests/Metadata/Internal/EntityTypeTest.BaseType.cs
  26. +1 −1 test/EFCore.Tests/Storage/ValueConversion/BytesToStringConverterTest.cs
  27. +1 −1 test/EFCore.Tests/Storage/ValueConversion/StringToBytesConverterTest.cs
4 changes: 2 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-831d23e" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-runtime-831d23e5/nuget/v3/index.json" />
<add key="darc-int-dotnet-runtime-f57e6dc" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-runtime-f57e6dc7/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-runtime -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
@@ -21,7 +21,7 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-831d23e" value="true" />
<add key="darc-int-dotnet-runtime-f57e6dc" value="true" />
<!-- End: Package sources from dotnet-runtime -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
</disabledPackageSources>
72 changes: 36 additions & 36 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Extensions.Caching.Memory" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.Caching.Memory" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration.Json" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.Configuration.Json" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.Configuration" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.DependencyInjection" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.DependencyInjection" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.DependencyModel" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.DependencyModel" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.HostFactoryResolver.Sources" Version="9.0.3-servicing.25111.13">
<Dependency Name="Microsoft.Extensions.HostFactoryResolver.Sources" Version="9.0.4-servicing.25163.5">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging" Version="9.0.3">
<Dependency Name="Microsoft.Extensions.Logging" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.3">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="9.0.3-servicing.25111.13">
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="9.0.4-servicing.25163.5">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<!--
Win-x64 is used here because we have picked an arbitrary runtime identifier to flow the version of the latest NETCore.App runtime.
All Runtime.$rid packages should have the same version.
-->
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="9.0.3">
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="System.Text.Json" Version="9.0.3">
<Dependency Name="System.Text.Json" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="System.Text.Encodings.Web" Version="9.0.3">
<Dependency Name="System.Text.Encodings.Web" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
<Dependency Name="System.Formats.Asn1" Version="9.0.3">
<Dependency Name="System.Formats.Asn1" Version="9.0.4">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>831d23e56149cd59c40fc00c7feb7c5334bd19c4</Sha>
<Sha>f57e6dc747158ab7ade4e62a75a6750d16b771e8</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25077.4">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25161.4">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bac7e1caea791275b7c3ccb4cb75fd6a04a26618</Sha>
<Sha>f33d9e642f0e68a61312164cd9e0baf4e142a999</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="9.0.0-beta.25077.4">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="9.0.0-beta.25161.4">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bac7e1caea791275b7c3ccb4cb75fd6a04a26618</Sha>
<Sha>f33d9e642f0e68a61312164cd9e0baf4e142a999</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.25077.4">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.25161.4">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bac7e1caea791275b7c3ccb4cb75fd6a04a26618</Sha>
<Sha>f33d9e642f0e68a61312164cd9e0baf4e142a999</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
34 changes: 17 additions & 17 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup Label="Version settings">
<VersionPrefix>9.0.3</VersionPrefix>
<VersionPrefix>9.0.4</VersionPrefix>
<PreReleaseVersionLabel>rtm</PreReleaseVersionLabel>
<PreReleaseVersionIteration>
</PreReleaseVersionIteration>
@@ -17,24 +17,24 @@
<UsingToolXliff>False</UsingToolXliff>
</PropertyGroup>
<PropertyGroup Label="Dependencies from dotnet/runtime">
<MicrosoftExtensionsCachingMemoryVersion>9.0.3</MicrosoftExtensionsCachingMemoryVersion>
<MicrosoftExtensionsConfigurationVersion>9.0.3</MicrosoftExtensionsConfigurationVersion>
<MicrosoftExtensionsConfigurationAbstractionsVersion>9.0.3</MicrosoftExtensionsConfigurationAbstractionsVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>9.0.3</MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>
<MicrosoftExtensionsConfigurationJsonVersion>9.0.3</MicrosoftExtensionsConfigurationJsonVersion>
<MicrosoftExtensionsDependencyInjectionVersion>9.0.3</MicrosoftExtensionsDependencyInjectionVersion>
<MicrosoftExtensionsDependencyModelVersion>9.0.3</MicrosoftExtensionsDependencyModelVersion>
<MicrosoftExtensionsHostFactoryResolverSourcesVersion>9.0.3-servicing.25111.13</MicrosoftExtensionsHostFactoryResolverSourcesVersion>
<MicrosoftExtensionsLoggingVersion>9.0.3</MicrosoftExtensionsLoggingVersion>
<MicrosoftNETCoreAppRefVersion>9.0.3</MicrosoftNETCoreAppRefVersion>
<MicrosoftNETCoreAppRuntimewinx64Version>9.0.3</MicrosoftNETCoreAppRuntimewinx64Version>
<MicrosoftNETCoreBrowserDebugHostTransportVersion>9.0.3-servicing.25111.13</MicrosoftNETCoreBrowserDebugHostTransportVersion>
<SystemTextEncodingsWebVersion>9.0.3</SystemTextEncodingsWebVersion>
<SystemTextJsonVersion>9.0.3</SystemTextJsonVersion>
<SystemFormatsAsn1Version>9.0.3</SystemFormatsAsn1Version>
<MicrosoftExtensionsCachingMemoryVersion>9.0.4</MicrosoftExtensionsCachingMemoryVersion>
<MicrosoftExtensionsConfigurationVersion>9.0.4</MicrosoftExtensionsConfigurationVersion>
<MicrosoftExtensionsConfigurationAbstractionsVersion>9.0.4</MicrosoftExtensionsConfigurationAbstractionsVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>9.0.4</MicrosoftExtensionsConfigurationEnvironmentVariablesVersion>
<MicrosoftExtensionsConfigurationJsonVersion>9.0.4</MicrosoftExtensionsConfigurationJsonVersion>
<MicrosoftExtensionsDependencyInjectionVersion>9.0.4</MicrosoftExtensionsDependencyInjectionVersion>
<MicrosoftExtensionsDependencyModelVersion>9.0.4</MicrosoftExtensionsDependencyModelVersion>
<MicrosoftExtensionsHostFactoryResolverSourcesVersion>9.0.4-servicing.25163.5</MicrosoftExtensionsHostFactoryResolverSourcesVersion>
<MicrosoftExtensionsLoggingVersion>9.0.4</MicrosoftExtensionsLoggingVersion>
<MicrosoftNETCoreAppRefVersion>9.0.4</MicrosoftNETCoreAppRefVersion>
<MicrosoftNETCoreAppRuntimewinx64Version>9.0.4</MicrosoftNETCoreAppRuntimewinx64Version>
<MicrosoftNETCoreBrowserDebugHostTransportVersion>9.0.4-servicing.25163.5</MicrosoftNETCoreBrowserDebugHostTransportVersion>
<SystemTextEncodingsWebVersion>9.0.4</SystemTextEncodingsWebVersion>
<SystemTextJsonVersion>9.0.4</SystemTextJsonVersion>
<SystemFormatsAsn1Version>9.0.4</SystemFormatsAsn1Version>
</PropertyGroup>
<PropertyGroup Label="Dependencies from dotnet/arcade">
<MicrosoftDotNetBuildTasksTemplatingVersion>9.0.0-beta.25077.4</MicrosoftDotNetBuildTasksTemplatingVersion>
<MicrosoftDotNetBuildTasksTemplatingVersion>9.0.0-beta.25161.4</MicrosoftDotNetBuildTasksTemplatingVersion>
</PropertyGroup>
<PropertyGroup Label="Other dependencies">
<MicrosoftBuildFrameworkVersion>17.8.3</MicrosoftBuildFrameworkVersion>
2 changes: 1 addition & 1 deletion eng/common/core-templates/steps/generate-sbom.yml
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ steps:
PackageName: ${{ parameters.packageName }}
BuildDropPath: ${{ parameters.buildDropPath }}
PackageVersion: ${{ parameters.packageVersion }}
ManifestDirPath: ${{ parameters.manifestDirPath }}
ManifestDirPath: ${{ parameters.manifestDirPath }}/$(ARTIFACT_NAME)
${{ if ne(parameters.IgnoreDirectories, '') }}:
AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}'

20 changes: 14 additions & 6 deletions eng/common/generate-sbom-prep.ps1
Original file line number Diff line number Diff line change
@@ -4,18 +4,26 @@ Param(

. $PSScriptRoot\pipeline-logging-functions.ps1

# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly
# with their own overwriting ours. So we create it as a sub directory of the requested manifest path.
$ArtifactName = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM"
$SafeArtifactName = $ArtifactName -replace '["/:<>\\|?@*"() ]', '_'
$SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName

Write-Host "Artifact name before : $ArtifactName"
Write-Host "Artifact name after : $SafeArtifactName"

Write-Host "Creating dir $ManifestDirPath"

# create directory for sbom manifest to be placed
if (!(Test-Path -path $ManifestDirPath))
if (!(Test-Path -path $SbomGenerationDir))
{
New-Item -ItemType Directory -path $ManifestDirPath
Write-Host "Successfully created directory $ManifestDirPath"
New-Item -ItemType Directory -path $SbomGenerationDir
Write-Host "Successfully created directory $SbomGenerationDir"
}
else{
Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder."
}

Write-Host "Updating artifact name"
$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_'
Write-Host "Artifact name $artifact_name"
Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name"
Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName"
17 changes: 11 additions & 6 deletions eng/common/generate-sbom-prep.sh
Original file line number Diff line number Diff line change
@@ -14,19 +14,24 @@ done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
. $scriptroot/pipeline-logging-functions.sh


# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts.
artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM"
safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}"
manifest_dir=$1

if [ ! -d "$manifest_dir" ] ; then
mkdir -p "$manifest_dir"
echo "Sbom directory created." $manifest_dir
# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly
# with their own overwriting ours. So we create it as a sub directory of the requested manifest path.
sbom_generation_dir="$manifest_dir/$safe_artifact_name"

if [ ! -d "$sbom_generation_dir" ] ; then
mkdir -p "$sbom_generation_dir"
echo "Sbom directory created." $sbom_generation_dir
else
Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder."
fi

artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM"
echo "Artifact name before : "$artifact_name
# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts.
safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}"
echo "Artifact name after : "$safe_artifact_name
export ARTIFACT_NAME=$safe_artifact_name
echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name"
1 change: 1 addition & 0 deletions eng/common/templates-official/job/job.yml
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ jobs:
parameters:
PackageVersion: ${{ parameters.packageVersion }}
BuildDropPath: ${{ parameters.buildDropPath }}
ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom
publishArtifacts: false

# publish artifacts
Original file line number Diff line number Diff line change
@@ -5,4 +5,4 @@ variables:
is1ESPipeline: true

${{ each parameter in parameters }}:
${{ parameter.key }}: ${{ parameter.value }}
${{ parameter.key }}: ${{ parameter.value }}
8 changes: 4 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"sdk": {
"version": "9.0.102",
"version": "9.0.104",
"allowPrerelease": true,
"rollForward": "latestMajor"
},
"tools": {
"dotnet": "9.0.102",
"dotnet": "9.0.104",
"runtimes": {
"dotnet": [
"$(MicrosoftNETCoreBrowserDebugHostTransportVersion)"
]
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25077.4",
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.25077.4"
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25161.4",
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.25161.4"
}
}
26 changes: 26 additions & 0 deletions src/EFCore.Design/Design/Internal/AppServiceProviderFactory.cs
Original file line number Diff line number Diff line change
@@ -89,4 +89,30 @@ private IServiceProvider CreateEmptyServiceProvider()

return new ServiceCollection().BuildServiceProvider();
}

/// <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>
public static void SetEnvironment(IOperationReporter reporter)
{
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));
}
}
3 changes: 3 additions & 0 deletions src/EFCore.Design/Design/Internal/DatabaseOperations.cs
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ namespace Microsoft.EntityFrameworkCore.Design.Internal;
/// </summary>
public class DatabaseOperations
{
private readonly IOperationReporter _reporter;
private readonly string _projectDir;
private readonly string? _rootNamespace;
private readonly string? _language;
@@ -34,6 +35,7 @@ public DatabaseOperations(
bool nullable,
string[]? args)
{
_reporter = reporter;
_projectDir = projectDir;
_rootNamespace = rootNamespace;
_language = language;
@@ -73,6 +75,7 @@ public virtual SavedModelFiles ScaffoldContext(
? Path.GetFullPath(Path.Combine(_projectDir, outputContextDir))
: outputDir;

AppServiceProviderFactory.SetEnvironment(_reporter);
var services = _servicesBuilder.Build(provider);
using var scope = services.CreateScope();

17 changes: 1 addition & 16 deletions src/EFCore.Design/Design/Internal/DbContextOperations.cs
Original file line number Diff line number Diff line change
@@ -503,22 +503,7 @@ 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));
AppServiceProviderFactory.SetEnvironment(_reporter);

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

Loading