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

Dissolve Relational.Design package #8680

Merged
merged 11 commits into from
Jun 2, 2017
44 changes: 1 addition & 43 deletions EFCore.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore", "src\EFCore\EFCore.csproj", "{715C38E9-B2F5-4DB2-8025-0C6492DEBDD4}"
EndProject
Expand All @@ -15,12 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Relational", "src\EF
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.Core", "src\EFCore.Sqlite.Core\EFCore.Sqlite.Core.csproj", "{A257C01B-BB91-44BA-831C-1E04F7800AC8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.SqlServer.Design", "src\EFCore.SqlServer.Design\EFCore.SqlServer.Design.csproj", "{DA30FC85-8D88-4BB2-98CE-B8A5845BB3EA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Relational.Design", "src\EFCore.Relational.Design\EFCore.Relational.Design.csproj", "{1942C281-C12B-4818-8CC8-C42842871FF5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.Design", "src\EFCore.Sqlite.Design\EFCore.Sqlite.Design.csproj", "{D94396A3-391F-4015-9B61-89A9E08D6618}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.SqlServer", "src\EFCore.SqlServer\EFCore.SqlServer.csproj", "{99595B81-D47C-40BA-8C61-5328A5A0E4AB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.CrossStore.FunctionalTests", "test\EFCore.CrossStore.FunctionalTests\EFCore.CrossStore.FunctionalTests.csproj", "{7EAC2B8E-4AF6-40D2-95C0-A6662762A7E0}"
Expand All @@ -29,22 +23,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.InMemory.FunctionalT
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.InMemory.Tests", "test\EFCore.InMemory.Tests\EFCore.InMemory.Tests.csproj", "{AB8D4BD7-8AB6-4004-AF21-32790EED93BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Relational.Design.Tests", "test\EFCore.Relational.Design.Tests\EFCore.Relational.Design.Tests.csproj", "{47DCCE35-C7FD-4E53-A0F9-BB8A7226978C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Relational.Tests", "test\EFCore.Relational.Tests\EFCore.Relational.Tests.csproj", "{1A884122-DC9E-42B1-8821-E43340F954D1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.Design.FunctionalTests", "test\EFCore.Sqlite.Design.FunctionalTests\EFCore.Sqlite.Design.FunctionalTests.csproj", "{2A62F6C9-B7F3-443B-A253-931D38879A9C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.Design.Tests", "test\EFCore.Sqlite.Design.Tests\EFCore.Sqlite.Design.Tests.csproj", "{DE5338E6-BD0D-45A1-9C53-FD05CFCE578E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.FunctionalTests", "test\EFCore.Sqlite.FunctionalTests\EFCore.Sqlite.FunctionalTests.csproj", "{7BB7D051-56D7-4A40-A29E-3801F5C19239}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.Tests", "test\EFCore.Sqlite.Tests\EFCore.Sqlite.Tests.csproj", "{7E436D99-82A6-496C-A725-0819CBED056D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.SqlServer.Design.FunctionalTests", "test\EFCore.SqlServer.Design.FunctionalTests\EFCore.SqlServer.Design.FunctionalTests.csproj", "{15033D6B-D415-4932-9462-F2A5AE0B75E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.SqlServer.Design.Tests", "test\EFCore.SqlServer.Design.Tests\EFCore.SqlServer.Design.Tests.csproj", "{C56644A1-114D-4401-AC79-4B9EC4EDD1E3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.SqlServer.FunctionalTests", "test\EFCore.SqlServer.FunctionalTests\EFCore.SqlServer.FunctionalTests.csproj", "{87AB43B7-767B-467B-9AA9-47BADF850D6A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.SqlServer.Tests", "test\EFCore.SqlServer.Tests\EFCore.SqlServer.Tests.csproj", "{7D1C4E40-0DE6-4C50-AB84-CA8647EA92DF}"
Expand Down Expand Up @@ -107,18 +95,6 @@ Global
{A257C01B-BB91-44BA-831C-1E04F7800AC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A257C01B-BB91-44BA-831C-1E04F7800AC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A257C01B-BB91-44BA-831C-1E04F7800AC8}.Release|Any CPU.Build.0 = Release|Any CPU
{DA30FC85-8D88-4BB2-98CE-B8A5845BB3EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA30FC85-8D88-4BB2-98CE-B8A5845BB3EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA30FC85-8D88-4BB2-98CE-B8A5845BB3EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA30FC85-8D88-4BB2-98CE-B8A5845BB3EA}.Release|Any CPU.Build.0 = Release|Any CPU
{1942C281-C12B-4818-8CC8-C42842871FF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1942C281-C12B-4818-8CC8-C42842871FF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1942C281-C12B-4818-8CC8-C42842871FF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1942C281-C12B-4818-8CC8-C42842871FF5}.Release|Any CPU.Build.0 = Release|Any CPU
{D94396A3-391F-4015-9B61-89A9E08D6618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D94396A3-391F-4015-9B61-89A9E08D6618}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D94396A3-391F-4015-9B61-89A9E08D6618}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D94396A3-391F-4015-9B61-89A9E08D6618}.Release|Any CPU.Build.0 = Release|Any CPU
{99595B81-D47C-40BA-8C61-5328A5A0E4AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99595B81-D47C-40BA-8C61-5328A5A0E4AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99595B81-D47C-40BA-8C61-5328A5A0E4AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -135,10 +111,6 @@ Global
{AB8D4BD7-8AB6-4004-AF21-32790EED93BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB8D4BD7-8AB6-4004-AF21-32790EED93BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB8D4BD7-8AB6-4004-AF21-32790EED93BC}.Release|Any CPU.Build.0 = Release|Any CPU
{47DCCE35-C7FD-4E53-A0F9-BB8A7226978C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47DCCE35-C7FD-4E53-A0F9-BB8A7226978C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47DCCE35-C7FD-4E53-A0F9-BB8A7226978C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47DCCE35-C7FD-4E53-A0F9-BB8A7226978C}.Release|Any CPU.Build.0 = Release|Any CPU
{1A884122-DC9E-42B1-8821-E43340F954D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A884122-DC9E-42B1-8821-E43340F954D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A884122-DC9E-42B1-8821-E43340F954D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -147,10 +119,6 @@ Global
{2A62F6C9-B7F3-443B-A253-931D38879A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A62F6C9-B7F3-443B-A253-931D38879A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A62F6C9-B7F3-443B-A253-931D38879A9C}.Release|Any CPU.Build.0 = Release|Any CPU
{DE5338E6-BD0D-45A1-9C53-FD05CFCE578E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE5338E6-BD0D-45A1-9C53-FD05CFCE578E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE5338E6-BD0D-45A1-9C53-FD05CFCE578E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE5338E6-BD0D-45A1-9C53-FD05CFCE578E}.Release|Any CPU.Build.0 = Release|Any CPU
{7BB7D051-56D7-4A40-A29E-3801F5C19239}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BB7D051-56D7-4A40-A29E-3801F5C19239}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BB7D051-56D7-4A40-A29E-3801F5C19239}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -163,10 +131,6 @@ Global
{15033D6B-D415-4932-9462-F2A5AE0B75E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15033D6B-D415-4932-9462-F2A5AE0B75E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15033D6B-D415-4932-9462-F2A5AE0B75E8}.Release|Any CPU.Build.0 = Release|Any CPU
{C56644A1-114D-4401-AC79-4B9EC4EDD1E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C56644A1-114D-4401-AC79-4B9EC4EDD1E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C56644A1-114D-4401-AC79-4B9EC4EDD1E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C56644A1-114D-4401-AC79-4B9EC4EDD1E3}.Release|Any CPU.Build.0 = Release|Any CPU
{87AB43B7-767B-467B-9AA9-47BADF850D6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87AB43B7-767B-467B-9AA9-47BADF850D6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87AB43B7-767B-467B-9AA9-47BADF850D6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -256,21 +220,15 @@ Global
{6B102CC4-4396-4A7B-9F72-2C6B5C4D8310} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}
{6A25DF99-2615-46D8-9532-821764647EE1} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}
{A257C01B-BB91-44BA-831C-1E04F7800AC8} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}
{DA30FC85-8D88-4BB2-98CE-B8A5845BB3EA} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}
{1942C281-C12B-4818-8CC8-C42842871FF5} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}
{D94396A3-391F-4015-9B61-89A9E08D6618} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}
{99595B81-D47C-40BA-8C61-5328A5A0E4AB} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}
{7EAC2B8E-4AF6-40D2-95C0-A6662762A7E0} = {258D5057-81B9-40EC-A872-D21E27452749}
{305B30D3-0E30-46E9-BA9D-060E0B79BE98} = {258D5057-81B9-40EC-A872-D21E27452749}
{AB8D4BD7-8AB6-4004-AF21-32790EED93BC} = {258D5057-81B9-40EC-A872-D21E27452749}
{47DCCE35-C7FD-4E53-A0F9-BB8A7226978C} = {258D5057-81B9-40EC-A872-D21E27452749}
{1A884122-DC9E-42B1-8821-E43340F954D1} = {258D5057-81B9-40EC-A872-D21E27452749}
{2A62F6C9-B7F3-443B-A253-931D38879A9C} = {258D5057-81B9-40EC-A872-D21E27452749}
{DE5338E6-BD0D-45A1-9C53-FD05CFCE578E} = {258D5057-81B9-40EC-A872-D21E27452749}
{7BB7D051-56D7-4A40-A29E-3801F5C19239} = {258D5057-81B9-40EC-A872-D21E27452749}
{7E436D99-82A6-496C-A725-0819CBED056D} = {258D5057-81B9-40EC-A872-D21E27452749}
{15033D6B-D415-4932-9462-F2A5AE0B75E8} = {258D5057-81B9-40EC-A872-D21E27452749}
{C56644A1-114D-4401-AC79-4B9EC4EDD1E3} = {258D5057-81B9-40EC-A872-D21E27452749}
{87AB43B7-767B-467B-9AA9-47BADF850D6A} = {258D5057-81B9-40EC-A872-D21E27452749}
{7D1C4E40-0DE6-4C50-AB84-CA8647EA92DF} = {258D5057-81B9-40EC-A872-D21E27452749}
{313F46FE-9962-4A15-805F-FCBDF5A6181E} = {258D5057-81B9-40EC-A872-D21E27452749}
Expand Down
25 changes: 11 additions & 14 deletions src/EFCore.Design/Design/Internal/DatabaseOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,18 @@ public virtual Task<ReverseEngineerFiles> ScaffoldContextAsync(
loggerFactory.AddProvider(new LoggerProvider(categoryName => new OperationLogger(categoryName, _reporter)));
#pragma warning restore CS0618 // Type or member is obsolete

var generator = services.GetRequiredService<ReverseEngineeringGenerator>();
var tableSelectionSet = new TableSelectionSet(tables, schemas);
var configuration = new ReverseEngineeringConfiguration
{
ConnectionString = connectionString,
ContextClassName = dbContextClassName,
ProjectPath = _projectDir,
ProjectRootNamespace = _rootNamespace,
OutputPath = outputDir,
TableSelectionSet = tableSelectionSet,
UseFluentApiOnly = !useDataAnnotations,
OverwriteFiles = overwriteFiles
};
var generator = services.GetRequiredService<ModelScaffolder>();

return generator.GenerateAsync(configuration, cancellationToken);
return generator.GenerateAsync(
connectionString,
new TableSelectionSet(tables, schemas),
_projectDir,
outputDir,
_rootNamespace,
dbContextClassName,
useDataAnnotations,
overwriteFiles,
cancellationToken);
}
}
}
95 changes: 95 additions & 0 deletions src/EFCore.Design/Diagnostics/DesignEventId.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics;
using Microsoft.Extensions.Logging;

namespace Microsoft.EntityFrameworkCore.Diagnostics
{
/// <summary>
/// <para>
/// Event IDs for design events that correspond to messages logged to an <see cref="ILogger" />
/// and events sent to a <see cref="DiagnosticSource" />.
/// </para>
/// <para>
/// These IDs are also used with <see cref="WarningsConfigurationBuilder" /> to configure the
/// behavior of warnings.
/// </para>
/// </summary>
public static class DesignEventId
{
// Warning: These values must not change between releases.
// Only add new values to the end of sections, never in the middle.
// Try to use <Noun><Verb> naming and be consistent with existing names.
private enum Id
{
// Scaffolding warning events
MissingSchemaWarning = CoreEventId.CoreDesignBaseId,
SequenceTypeNotSupportedWarning,
UnableToGenerateEntityTypeWarning,
ColumnTypeNotMappedWarning,
MissingPrimaryKeyWarning,
PrimaryKeyColumnsNotMappedWarning,
ForeignKeyReferencesNotMappedTableWarning,
ForeignKeyReferencesMissingPrincipalKeyWarning,
ForeignKeyPrincipalEndContainsNullableColumnsWarning
}

private static readonly string _scaffoldingPrefix = DbLoggerCategory.Scaffolding.Name + ".";
private static EventId MakeScaffoldingId(Id id) => new EventId((int)id, _scaffoldingPrefix + id);

/// <summary>
/// The database is missing a schema.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId MissingSchemaWarning = MakeScaffoldingId(Id.MissingSchemaWarning);

/// <summary>
/// The database has a sequence of a type that is not supported.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId SequenceTypeNotSupportedWarning = MakeScaffoldingId(Id.SequenceTypeNotSupportedWarning);

/// <summary>
/// An entity type could not be generated.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId UnableToGenerateEntityTypeWarning = MakeScaffoldingId(Id.UnableToGenerateEntityTypeWarning);

/// <summary>
/// A column type could not be mapped.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId ColumnTypeNotMappedWarning = MakeScaffoldingId(Id.ColumnTypeNotMappedWarning);

/// <summary>
/// A table is missing a primary key.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId MissingPrimaryKeyWarning = MakeScaffoldingId(Id.MissingPrimaryKeyWarning);

/// <summary>
/// Columns in a primary key were not mapped.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId PrimaryKeyColumnsNotMappedWarning = MakeScaffoldingId(Id.PrimaryKeyColumnsNotMappedWarning);

/// <summary>
/// A foreign key references a table that was not mapped.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId ForeignKeyReferencesNotMappedTableWarning = MakeScaffoldingId(Id.ForeignKeyReferencesNotMappedTableWarning);

/// <summary>
/// A foreign key references missing prinicpal key columns.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId ForeignKeyReferencesMissingPrincipalKeyWarning = MakeScaffoldingId(Id.ForeignKeyReferencesMissingPrincipalKeyWarning);

/// <summary>
/// A principal key contains nullable columns.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </summary>
public static readonly EventId ForeignKeyPrincipalEndContainsNullableColumnsWarning = MakeScaffoldingId(Id.ForeignKeyPrincipalEndContainsNullableColumnsWarning);
}
}
2 changes: 1 addition & 1 deletion src/EFCore.Design/EFCore.Design.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\EFCore.Relational.Design\EFCore.Relational.Design.csproj" />
<ProjectReference Include="..\EFCore.Relational\EFCore.Relational.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading