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

Upgrade to 2.0.0-preview2 #306

Merged
merged 51 commits into from
Jul 3, 2017
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2ff5ad2
initial 2.0.0 refactor
caleblloyd Jun 6, 2017
bb7ab4d
shorten path to EFCore.MySql
caleblloyd Jun 6, 2017
fab33d1
fix nuget warnings
caleblloyd Jun 8, 2017
101e058
2.0.0 wip
caleblloyd Jun 10, 2017
42fdb6f
appveyor install .NET Core 2.0
caleblloyd Jun 10, 2017
f9e0689
travis use .NET Core 2.0
caleblloyd Jun 10, 2017
b64c12f
ci path updates
caleblloyd Jun 10, 2017
563085d
ci notification updates
caleblloyd Jun 10, 2017
8fbeeb3
fix dependency
caleblloyd Jun 11, 2017
9efbb00
move ConnectionSettings to MySqlOptions
caleblloyd Jun 11, 2017
c29c388
add errorsExpected arg to OpenAsync
caleblloyd Jun 13, 2017
da21634
add debug logging
caleblloyd Jun 15, 2017
bba0056
fix test build issues
caleblloyd Jun 15, 2017
c420761
Fixes migration unit tests
yukozh Jun 16, 2017
9980678
Clean up
yukozh Jun 16, 2017
2ea2961
ConnectionSettings lazy initialize
caleblloyd Jun 16, 2017
89d5cb7
Merge remote-tracking branch 'refs/remotes/origin/dev' into fix-migra…
yukozh Jun 16, 2017
d804cfd
Decrease failed case into 3
yukozh Jun 16, 2017
bc3bfe7
Revert value generated on add of datetime case
yukozh Jun 16, 2017
414ce69
Merge pull request #293 from PomeloFoundation/fix-migraion-2-0-0
caleblloyd Jun 16, 2017
5dd4b6c
make TypeMapper singleton
caleblloyd Jun 19, 2017
504e995
GetAnnotation has been removed
caleblloyd Jun 20, 2017
6264f46
remove IRelationalConnection from MySqlMigrationsSqlGenerator
caleblloyd Jun 21, 2017
711f18d
ConfigureAwait false
caleblloyd Jun 21, 2017
faf59fc
Update LICENSE
yukozh Jun 22, 2017
2f23062
add back MySqlRelationalCommand
caleblloyd Jun 27, 2017
4b3ec79
migrations up working
caleblloyd Jun 27, 2017
a2fcca2
Merge remote-tracking branch 'upstream/dev' into dev
caleblloyd Jun 27, 2017
5ebbb4d
EF expects LAST_INSERT_ID() to be proper type
caleblloyd Jun 28, 2017
0a33e74
use preview2-final
caleblloyd Jun 30, 2017
b5f1b5f
fix tests
caleblloyd Jun 30, 2017
9c47489
use NetStandard.Library 2.0.0-*
caleblloyd Jun 30, 2017
4a0cbb9
Implement scaffolding 2.0
yukozh Jul 1, 2017
35b77b2
Removed postgres
yukozh Jul 1, 2017
0f452e4
Update package icon url
yukozh Jul 1, 2017
f784dc9
Fixed value generation
yukozh Jul 1, 2017
b931392
Fixes test cases
yukozh Jul 1, 2017
231f49f
Fixed all ut cases
yukozh Jul 1, 2017
9fae0a2
Fixed object null test cases
yukozh Jul 1, 2017
028e9b2
Fix functional test script
yukozh Jul 1, 2017
7758af2
Fixed functional test script
yukozh Jul 1, 2017
e8bfde5
Merge pull request #303 from PomeloFoundation/fix-value-generation
yukozh Jul 1, 2017
049dbc1
Merge pull request #301 from PomeloFoundation/enable-scaffolding
caleblloyd Jul 1, 2017
73ca0e9
remove UntypedRelationalValueBufferFactoryFactory
caleblloyd Jul 1, 2017
f9f3a4b
fix Expression Translators
caleblloyd Jul 3, 2017
d8ca9b1
fix Functional Tests namespace
caleblloyd Jul 3, 2017
e53d8fe
add back rename column operation
caleblloyd Jul 3, 2017
b8cdcb4
switch license to Pomelo Foundation
caleblloyd Jul 3, 2017
24c5fd6
remove clustered; update tooling to preview2
caleblloyd Jul 3, 2017
5ac58a4
remove clustered extensions
caleblloyd Jul 3, 2017
8b38885
ignore test configs
caleblloyd Jul 3, 2017
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
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ branches:

before_install:
- docker run --name mysql -e MYSQL_ROOT_PASSWORD=Password12! -d mysql:5.7
- docker run -v $(pwd):/dotnet/:rw -e 'CI=True' --name dotnet --link mysql:mysql -d microsoft/dotnet:1.1.1-sdk sh -c 'while true; do sleep 0.1; done'
- docker run -v $(pwd):/dotnet/:rw -e 'CI=True' --name dotnet --link mysql:mysql -d microsoft/dotnet:2.0.0-preview1-sdk sh -c 'while true; do sleep 0.1; done'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preview2 sdk


script:
- docker exec -it dotnet sh -c 'cd /dotnet && dotnet restore'
- docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.Tests && dotnet test -c Release'
- echo "Building migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && cp config.json.example config.json && sed -i "s/127.0.0.1/mysql/g" config.json && ./scripts/rebuild.sh'
- echo "Test applying migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && dotnet run -c Release testMigrate'
- echo "Test scaffolding" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && ./scripts/scaffold.sh; rc=$?; rm -rf Scaffold; exit $rc'
- echo "Test with EF_BATCH_SIZE=1" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && dotnet test -c Release'
- echo "Test with EF_BATCH_SIZE=10" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && export EF_BATCH_SIZE=10 && dotnet test -c Release'
- echo "Building migrations with EF_DATABASE=pomelo_test2" && docker exec -it mysql sh -c 'mysql -uroot -pPassword12! -e "CREATE SCHEMA IF NOT EXISTS pomelo_test2;"' && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && export EF_SCHEMA=pomelo_test2 && ./scripts/rebuild.sh'
- echo "Test with EF_SCHEMA=pomelo_test2" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && export EF_SCHEMA=pomelo_test2 && dotnet test -c Release'
- docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.Tests && dotnet test -c Release'
- echo "Building migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& cp config.json.example config.json && sed -i "s/127.0.0.1/mysql/g" config.json && ./scripts/rebuild.sh'
- echo "Test applying migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& dotnet run -c Release testMigrate'
- echo "Test scaffolding" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& ./scripts/scaffold.sh; rc=$?; rm -rf Scaffold; exit $rc'
- echo "Test with EF_BATCH_SIZE=1" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& dotnet test -c Release'
- echo "Test with EF_BATCH_SIZE=10" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& export EF_BATCH_SIZE=10 && dotnet test -c Release'
- echo "Building migrations with EF_DATABASE=pomelo_test2" && docker exec -it mysql sh -c 'mysql -uroot -pPassword12! -e "CREATE SCHEMA IF NOT EXISTS pomelo_test2;"' && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& export EF_SCHEMA=pomelo_test2 && ./scripts/rebuild.sh'
- echo "Test with EF_SCHEMA=pomelo_test2" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& export EF_SCHEMA=pomelo_test2 && dotnet test -c Release'

notifications:
email: false
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Code Comb™ Co., Ltd.
Copyright (c) 2017 Pomelo Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions NuGet.config
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>
21 changes: 7 additions & 14 deletions Pomelo.EntityFrameworkCore.MySql.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
VisualStudioVersion = 15.0.26621.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7E8380DB-F015-407B-99C2-26404E551673}"
EndProject
Expand All @@ -21,15 +21,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{212DAE3C-D991-4213-AC4B-E23E923F2DC7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.MySql", "src\EFCore.MySql\EFCore.MySql.csproj", "{FC2779F0-2A2A-4BE2-B5A8-FDA31A4A404A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql", "src\Pomelo.EntityFrameworkCore.MySql\Pomelo.EntityFrameworkCore.MySql.csproj", "{FC2779F0-2A2A-4BE2-B5A8-FDA31A4A404A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.MySql.Tests", "test\EFCore.MySql.Tests\EFCore.MySql.Tests.csproj", "{DE5212AE-4C17-4702-851D-0F1FC0D32E3C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql.Tests", "test\Pomelo.EntityFrameworkCore.MySql.Tests\Pomelo.EntityFrameworkCore.MySql.Tests.csproj", "{DE5212AE-4C17-4702-851D-0F1FC0D32E3C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql.PerfTests", "test\Pomelo.EntityFrameworkCore.MySql.PerfTests\Pomelo.EntityFrameworkCore.MySql.PerfTests.csproj", "{E7D9C7D9-1CDD-4745-975D-9752AE095418}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql.Design", "src\Pomelo.EntityFrameworkCore.MySql.Design\Pomelo.EntityFrameworkCore.MySql.Design.csproj", "{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.MySql.FunctionalTests", "test\EFCore.MySql.FunctionalTests\EFCore.MySql.FunctionalTests.csproj", "{E7D9C7D9-1CDD-4745-975D-9752AE095418}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -49,19 +45,16 @@ Global
{E7D9C7D9-1CDD-4745-975D-9752AE095418}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7D9C7D9-1CDD-4745-975D-9752AE095418}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7D9C7D9-1CDD-4745-975D-9752AE095418}.Release|Any CPU.Build.0 = Release|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{212DAE3C-D991-4213-AC4B-E23E923F2DC7} = {7E8380DB-F015-407B-99C2-26404E551673}
{FC2779F0-2A2A-4BE2-B5A8-FDA31A4A404A} = {7E8380DB-F015-407B-99C2-26404E551673}
{DE5212AE-4C17-4702-851D-0F1FC0D32E3C} = {6EC4A4AA-D865-4EF9-BD52-C2D0AA075CDF}
{E7D9C7D9-1CDD-4745-975D-9752AE095418} = {6EC4A4AA-D865-4EF9-BD52-C2D0AA075CDF}
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0} = {7E8380DB-F015-407B-99C2-26404E551673}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {48E34212-4B35-4A81-92F9-3C25D4E76D6C}
EndGlobalSection
EndGlobal
67 changes: 33 additions & 34 deletions build-run.ps1
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)
{
Expand All @@ -19,7 +19,7 @@ function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $ret
Start-Sleep -Seconds 10

}
else
else
{
$exception = $_.Exception
throw $exception
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The 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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preview2


dotnet --info

##########################
# BEGIN REPOSITORY TESTS
Expand All @@ -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"
Expand Down Expand Up @@ -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){
Expand Down
29 changes: 29 additions & 0 deletions src/EFCore.MySql/Design/Internal/MySqlAnnotationCodeGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using JetBrains.Annotations;
Copy link
Member

Choose a reason for hiding this comment

The 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;
}
}
}
20 changes: 20 additions & 0 deletions src/EFCore.MySql/Design/Internal/MySqlDesignTimeServices.cs
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>
35 changes: 35 additions & 0 deletions src/EFCore.MySql/Extensions/MySqlDatabaseFacadeExtensions.cs
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);
}
}
Loading