-
Notifications
You must be signed in to change notification settings - Fork 386
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
Upgrade to 2.0.0-preview2 #306
Changes from 48 commits
2ff5ad2
bb7ab4d
fab33d1
101e058
42fdb6f
f9e0689
b64c12f
563085d
8fbeeb3
9efbb00
c29c388
da21634
bba0056
c420761
9980678
2ea2961
89d5cb7
d804cfd
bc3bfe7
414ce69
5dd4b6c
504e995
6264f46
711f18d
faf59fc
2f23062
4b3ec79
a2fcca2
5ebbb4d
0a33e74
b5f1b5f
9c47489
4a0cbb9
35b77b2
0f452e4
f784dc9
b931392
231f49f
9fae0a2
028e9b2
7758af2
e8bfde5
049dbc1
73ca0e9
f9f3a4b
d8ca9b1
e53d8fe
b8cdcb4
24c5fd6
5ac58a4
8b38885
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<!--<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />--> | ||
<add key="Pomelo" value="https://www.myget.org/F/pomelo/api/v3/index.json" /> | ||
<add key="nuget.org" value="https://www.nuget.org/api/v2" /> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | ||
</packageSources> | ||
</configuration> | ||
</configuration> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
$ErrorActionPreference = "Stop" | ||
|
||
function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) | ||
function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) | ||
{ | ||
while($true) | ||
{ | ||
|
@@ -19,7 +19,7 @@ function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $ret | |
Start-Sleep -Seconds 10 | ||
|
||
} | ||
else | ||
else | ||
{ | ||
$exception = $_.Exception | ||
throw $exception | ||
|
@@ -28,12 +28,10 @@ function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $ret | |
} | ||
} | ||
|
||
cd $PSScriptRoot | ||
|
||
$repoFolder = $PSScriptRoot | ||
$env:REPO_FOLDER = $repoFolder | ||
|
||
$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.0.0-msbuild-rtm.zip" | ||
$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0-preview1.zip" | ||
if ($env:KOREBUILD_ZIP) | ||
{ | ||
$koreBuildZip=$env:KOREBUILD_ZIP | ||
|
@@ -42,18 +40,18 @@ if ($env:KOREBUILD_ZIP) | |
$buildFolder = ".build" | ||
|
||
if (!(Test-Path $buildFolder)) { | ||
Write-Host "Downloading KoreBuild from $koreBuildZip" | ||
Write-Host "Downloading KoreBuild from $koreBuildZip" | ||
|
||
$tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() | ||
New-Item -Path "$tempFolder" -Type directory | Out-Null | ||
|
||
$localZipFile="$tempFolder\korebuild.zip" | ||
|
||
DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 | ||
|
||
Add-Type -AssemblyName System.IO.Compression.FileSystem | ||
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) | ||
|
||
New-Item -Path "$buildFolder" -Type directory | Out-Null | ||
copy-item "$tempFolder\**\build\*" $buildFolder -Recurse | ||
|
||
|
@@ -63,29 +61,39 @@ if (!(Test-Path $buildFolder)) { | |
} | ||
} | ||
|
||
$dotnetVersion = "1.0.0" | ||
$dotnetChannel = "rel-1.0.0" | ||
$dotnetSharedRuntimeVersion = "1.1.1" | ||
$dotnetSharedRuntimeChannel = "rel-1.0.0" | ||
$dotnetArch = 'x64' | ||
$dotnetChannel = "preview" | ||
$dotnetVersion = "2.0.0-preview1-005957" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. preview2 |
||
|
||
$dotnetLocalInstallFolder = $env:DOTNET_INSTALL_DIR | ||
if (!$dotnetLocalInstallFolder) | ||
{ | ||
$dotnetLocalInstallFolder = "$env:LOCALAPPDATA\Microsoft\dotnet\" | ||
} | ||
|
||
function InstallSharedRuntime([string] $version, [string] $channel) | ||
{ | ||
$sharedRuntimePath = [IO.Path]::Combine($dotnetLocalInstallFolder, 'shared', 'Microsoft.NETCore.App', $version) | ||
# Avoid redownloading the CLI if it's already installed. | ||
if (!(Test-Path $sharedRuntimePath)) | ||
{ | ||
& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $channel ` | ||
-SharedRuntime ` | ||
-Version $version ` | ||
-Architecture $dotnetArch ` | ||
-InstallDir $dotnetLocalInstallFolder | ||
} | ||
} | ||
|
||
# Sometimes, MyGet re-uses a build server, clean SDK before attempting to install | ||
if ($env:BuildRunner -eq "MyGet"){ | ||
Remove-Item -Force -Recurse $dotnetLocalInstallFolder | ||
} | ||
|
||
& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $dotnetChannel -Version $dotnetVersion -Architecture x64 | ||
# Avoid redownloading the CLI if it's already installed. | ||
$sharedRuntimePath = [IO.Path]::Combine($dotnetLocalInstallFolder, 'shared', 'Microsoft.NETCore.App', $dotnetSharedRuntimeVersion) | ||
if (!(Test-Path $sharedRuntimePath)) | ||
{ | ||
& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $dotnetSharedRuntimeChannel -SharedRuntime -Version $dotnetSharedRuntimeVersion -Architecture x64 | ||
} | ||
& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $dotnetChannel -Version $dotnetVersion -Architecture $dotnetArch | ||
InstallSharedRuntime -version "1.1.2" -channel "release/1.1.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. preview2 |
||
|
||
dotnet --info | ||
|
||
########################## | ||
# BEGIN REPOSITORY TESTS | ||
|
@@ -98,23 +106,23 @@ if ($LASTEXITCODE -ne 0){ | |
exit $LASTEXITCODE; | ||
} | ||
|
||
# build .NET 451 to verify no build errors | ||
cd (Join-Path $repoFolder (Join-Path "src" "Pomelo.EntityFrameworkCore.MySql")) | ||
# build to verify no build errors | ||
cd (Join-Path $repoFolder (Join-Path "src" "EFCore.MySql")) | ||
dotnet build -c Release | ||
if ($LASTEXITCODE -ne 0){ | ||
exit $LASTEXITCODE; | ||
} | ||
|
||
# run unit tests | ||
cd (Join-Path $repoFolder (Join-Path "test" "Pomelo.EntityFrameworkCore.MySql.Tests")) | ||
cd (Join-Path $repoFolder (Join-Path "test" "EFCore.MySql.Tests")) | ||
dotnet test -c Release | ||
if ($LASTEXITCODE -ne 0){ | ||
exit $LASTEXITCODE; | ||
} | ||
|
||
# run functional tests if not on MyGet | ||
if ($env:BuildRunner -ne "MyGet"){ | ||
cd (Join-Path $repoFolder (Join-Path "test" "Pomelo.EntityFrameworkCore.MySql.PerfTests")) | ||
cd (Join-Path $repoFolder (Join-Path "test" "EFCore.MySql.FunctionalTests")) | ||
cp config.json.example config.json | ||
|
||
echo "Building Migrations" | ||
|
@@ -145,16 +153,7 @@ if ($env:BuildRunner -ne "MyGet"){ | |
########################## | ||
|
||
# MyGet expects nuget packages to be build | ||
cd (Join-Path $repoFolder (Join-Path "src" "Pomelo.EntityFrameworkCore.MySql")) | ||
if ($env:BuildRunner -eq "MyGet"){ | ||
dotnet pack -c Release | ||
if ($LASTEXITCODE -ne 0){ | ||
exit $LASTEXITCODE; | ||
} | ||
} | ||
|
||
# MyGet expects nuget packages to be build | ||
cd (Join-Path $repoFolder (Join-Path "src" "Pomelo.EntityFrameworkCore.MySql.Design")) | ||
cd (Join-Path $repoFolder (Join-Path "src" "EFCore.MySql")) | ||
if ($env:BuildRunner -eq "MyGet"){ | ||
dotnet pack -c Release | ||
if ($LASTEXITCODE -ne 0){ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using JetBrains.Annotations; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing License |
||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Utilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Design.Internal | ||
{ | ||
public class MySqlAnnotationCodeGenerator : AnnotationCodeGenerator | ||
{ | ||
public MySqlAnnotationCodeGenerator([NotNull] AnnotationCodeGeneratorDependencies dependencies) | ||
: base(dependencies) | ||
{ | ||
} | ||
|
||
public override bool IsHandledByConvention(IModel model, IAnnotation annotation) | ||
{ | ||
return true; | ||
} | ||
|
||
public override string GenerateFluentApi(IIndex index, IAnnotation annotation, string language) | ||
{ | ||
Check.NotNull(index, nameof(index)); | ||
Check.NotNull(annotation, nameof(annotation)); | ||
Check.NotNull(language, nameof(language)); | ||
|
||
return null; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.EntityFrameworkCore.Scaffolding; | ||
using Microsoft.EntityFrameworkCore.Scaffolding.Internal; | ||
using Microsoft.EntityFrameworkCore.Storage; | ||
using Microsoft.EntityFrameworkCore.Storage.Internal; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Design.Internal | ||
{ | ||
public class MySqlDesignTimeServices : IDesignTimeServices | ||
{ | ||
public void ConfigureDesignTimeServices(IServiceCollection serviceCollection) | ||
{ | ||
serviceCollection | ||
.AddSingleton<IScaffoldingProviderCodeGenerator, MySqlScaffoldingCodeGenerator>() | ||
.AddSingleton<IDatabaseModelFactory, MySqlDatabaseModelFactory>() | ||
.AddSingleton<IAnnotationCodeGenerator, MySqlAnnotationCodeGenerator>() | ||
.AddSingleton<IRelationalTypeMapper, MySqlTypeMapper>(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<VersionPrefix>1.1.1</VersionPrefix> | ||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks> | ||
<VersionPrefix>2.0.0</VersionPrefix> | ||
<TargetFrameworks>netstandard2.0</TargetFrameworks> | ||
<NetStandardImplicitPackageVersion>2.0.0-*</NetStandardImplicitPackageVersion> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<AssemblyName>Pomelo.EntityFrameworkCore.MySql</AssemblyName> | ||
<PackageId>Pomelo.EntityFrameworkCore.MySql</PackageId> | ||
<PackageTags>Entity Framework Core;entity-framework-core;MySQL;EF;ORM;Data</PackageTags> | ||
<PackageIconUrl>http://www.1234.sh/assets/Shared/pomelofoundation.png</PackageIconUrl> | ||
<PackageIconUrl>https://avatars2.githubusercontent.com/u/19828814?v=3</PackageIconUrl> | ||
<PackageProjectUrl>https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql</PackageProjectUrl> | ||
<PackageLicenseUrl>https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/blob/master/LICENSE</PackageLicenseUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>git://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql</RepositoryUrl> | ||
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute> | ||
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.1" /> | ||
<PackageReference Include="MySqlConnector" Version="0.19.*" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.0-preview2-final" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0-preview2-final" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0-preview2-final" /> | ||
<PackageReference Include="MySqlConnector" Version="0.22.*" /> | ||
<PackageReference Include="Pomelo.JsonObject" Version="1.1.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' "> | ||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.3.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' "> | ||
<Reference Include="System" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) Pomelo Foundation. All rights reserved. | ||
// Licensed under the MIT. See LICENSE in the project root for license information. | ||
|
||
using System; | ||
using System.Reflection; | ||
using JetBrains.Annotations; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Infrastructure.Internal; | ||
|
||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
/// <summary> | ||
/// SQL Server specific extension methods for <see cref="DbContext.Database" />. | ||
/// </summary> | ||
public static class MySqlDatabaseFacadeExtensions | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Returns true if the database provider currently in use is the SQL Server provider. | ||
/// </para> | ||
/// <para> | ||
/// This method can only be used after the <see cref="DbContext" /> has been configured because | ||
/// it is only then that the provider is known. This means that this method cannot be used | ||
/// in <see cref="DbContext.OnConfiguring" /> because this is where application code sets the | ||
/// provider to use as part of configuring the context. | ||
/// </para> | ||
/// </summary> | ||
/// <param name="database"> The facade from <see cref="DbContext.Database" />. </param> | ||
/// <returns> True if SQL Server is being used; false otherwise. </returns> | ||
public static bool IsMySql([NotNull] this DatabaseFacade database) | ||
=> database.ProviderName.Equals( | ||
typeof(MySqlOptionsExtension).GetTypeInfo().Assembly.GetName().Name, | ||
StringComparison.Ordinal); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preview2 sdk