Skip to content

Commit

Permalink
Make more internal code public
Browse files Browse the repository at this point in the history
This is mostly adding proper docs to things that should be public but were still documented as internal. Also moved a few types accordingly, and made a few things really internal or private.

Fixes #15442
Fixes #15441
Fixes #15107
  • Loading branch information
ajcvickers committed Apr 22, 2019
1 parent 2c0b78c commit 32a7833
Show file tree
Hide file tree
Showing 52 changed files with 338 additions and 445 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.InMemory.Diagnostics.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Metadata.Conventions.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Metadata.Conventions;
using Microsoft.EntityFrameworkCore.InMemory.Query.ExpressionVisitors.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Query.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Storage.Internal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.EntityFrameworkCore.InMemory.Metadata.Conventions.Internal
namespace Microsoft.EntityFrameworkCore.InMemory.Metadata.Conventions
{
/// <summary>
/// <para>
/// 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.
/// A builder for building conventions for th in-memory provider.
/// </para>
/// <para>
/// The service lifetime is <see cref="ServiceLifetime.Scoped"/> and multiple registrations
Expand All @@ -27,23 +24,26 @@ namespace Microsoft.EntityFrameworkCore.InMemory.Metadata.Conventions.Internal
public class InMemoryConventionSetBuilder : ProviderConventionSetBuilder
{
/// <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.
/// Creates a new <see cref="InMemoryConventionSetBuilder"/> instance.
/// </summary>
/// <param name="dependencies"> The core dependencies for this service. </param>
public InMemoryConventionSetBuilder(
[NotNull] ProviderConventionSetBuilderDependencies dependencies)
: base(dependencies)
{
}

/// <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.
/// <para>
/// Call this method to build a <see cref="ConventionSet"/> for the in-memory provider when using
/// the <see cref="ModelBuilder"/> outside of <see cref="DbContext.OnModelCreating"/>.
/// </para>
/// <para>
/// Note that it is unusual to use this method.
/// Consider using <see cref="DbContext"/> in the normal way instead.
/// </para>
/// </summary>
/// <returns> The convention set. </returns>
public static ConventionSet Build()
{
var serviceProvider = new ServiceCollection()
Expand Down
85 changes: 35 additions & 50 deletions src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ public override void Validate(IModel model, DiagnosticsLoggers loggers)
}

/// <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.
/// Validates the mapping/configuration of functions in the model.
/// </summary>
[EntityFrameworkInternal]
/// <param name="model"> The model to validate. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateDbFunctions([NotNull] IModel model, DiagnosticsLoggers loggers)
{
foreach (var dbFunction in model.Relational().DbFunctions)
Expand Down Expand Up @@ -107,12 +105,10 @@ protected virtual void ValidateDbFunctions([NotNull] IModel model, DiagnosticsLo
}

/// <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.
/// Validates the mapping/configuration of <see cref="bool"/> properties in the model.
/// </summary>
[EntityFrameworkInternal]
/// <param name="model"> The model to validate. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateBoolsWithDefaults([NotNull] IModel model, DiagnosticsLoggers loggers)
{
Check.NotNull(model, nameof(model));
Expand All @@ -136,12 +132,10 @@ private static bool IsNotNullAndFalse(object value)
&& (!(value is bool asBool) || asBool);

/// <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.
/// Validates the mapping/configuration of default values in the model.
/// </summary>
[EntityFrameworkInternal]
/// <param name="model"> The model to validate. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateDefaultValuesOnKeys([NotNull] IModel model, DiagnosticsLoggers loggers)
{
var logger = loggers.GetLogger<DbLoggerCategory.Model.Validation>();
Expand All @@ -155,12 +149,10 @@ protected virtual void ValidateDefaultValuesOnKeys([NotNull] IModel model, Diagn
}

/// <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.
/// Validates the mapping/configuration of shared tables in the model.
/// </summary>
[EntityFrameworkInternal]
/// <param name="model"> The model to validate. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateSharedTableCompatibility([NotNull] IModel model, DiagnosticsLoggers loggers)
{
var tables = new Dictionary<string, List<IEntityType>>();
Expand Down Expand Up @@ -191,12 +183,11 @@ protected virtual void ValidateSharedTableCompatibility([NotNull] IModel model,
}

/// <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.
/// Validates the compatibility of entity types sharing a given table.
/// </summary>
[EntityFrameworkInternal]
/// <param name="mappedTypes"> The mapped entity types. </param>
/// <param name="tableName"> The table name. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateSharedTableCompatibility(
[NotNull] IReadOnlyList<IEntityType> mappedTypes, [NotNull] string tableName, DiagnosticsLoggers loggers)
{
Expand Down Expand Up @@ -292,12 +283,11 @@ private static bool IsIdentifyingPrincipal(IEntityType dependentEntityType, IEnt
}

/// <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.
/// Validates the compatibility of properties sharing columns in a given table.
/// </summary>
[EntityFrameworkInternal]
/// <param name="mappedTypes"> The mapped entity types. </param>
/// <param name="tableName"> The table name. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateSharedColumnsCompatibility(
[NotNull] IReadOnlyList<IEntityType> mappedTypes, [NotNull] string tableName, DiagnosticsLoggers loggers)
{
Expand Down Expand Up @@ -444,12 +434,11 @@ protected virtual void ValidateSharedColumnsCompatibility(
}

/// <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.
/// Validates the compatibility of foreign keys in a given shared table.
/// </summary>
[EntityFrameworkInternal]
/// <param name="mappedTypes"> The mapped entity types. </param>
/// <param name="tableName"> The table name. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateSharedForeignKeysCompatibility(
[NotNull] IReadOnlyList<IEntityType> mappedTypes, [NotNull] string tableName, DiagnosticsLoggers loggers)
{
Expand All @@ -469,12 +458,11 @@ protected virtual void ValidateSharedForeignKeysCompatibility(
}

/// <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.
/// Validates the compatibility of indexes in a given shared table.
/// </summary>
[EntityFrameworkInternal]
/// <param name="mappedTypes"> The mapped entity types. </param>
/// <param name="tableName"> The table name. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateSharedIndexesCompatibility(
[NotNull] IReadOnlyList<IEntityType> mappedTypes, [NotNull] string tableName, DiagnosticsLoggers loggers)
{
Expand All @@ -494,12 +482,11 @@ protected virtual void ValidateSharedIndexesCompatibility(
}

/// <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.
/// Validates the compatibility of primary and alternate keys in a given shared table.
/// </summary>
[EntityFrameworkInternal]
/// <param name="mappedTypes"> The mapped entity types. </param>
/// <param name="tableName"> The table name. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateSharedKeysCompatibility(
[NotNull] IReadOnlyList<IEntityType> mappedTypes, [NotNull] string tableName, DiagnosticsLoggers loggers)
{
Expand Down Expand Up @@ -533,12 +520,10 @@ protected virtual void ValidateSharedKeysCompatibility(
}

/// <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.
/// Validates the mapping/configuration of inheritance in the model.
/// </summary>
[EntityFrameworkInternal]
/// <param name="model"> The model to validate. </param>
/// <param name="loggers"> Loggers to use if needed. </param>
protected virtual void ValidateInheritanceMapping([NotNull] IModel model, DiagnosticsLoggers loggers)
{
foreach (var rootEntityType in model.GetRootEntityTypes())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ public HistoryRepositoryDependencies(
/// <summary>
/// The model logger
/// </summary>
[EntityFrameworkInternal]
public IDiagnosticsLogger<DbLoggerCategory.Model> ModelLogger { get; }

/// <summary>
Expand Down
8 changes: 2 additions & 6 deletions src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ public class MigrationsSqlGenerator : IMigrationsSqlGenerator
};

/// <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.
/// Creates a new <see cref="MigrationsSqlGenerator"/> instance using the given dependencies.
/// </summary>
/// <param name="dependencies"> Parameter object containing dependencies for this service. </param>
[EntityFrameworkInternal]
public MigrationsSqlGenerator([NotNull] MigrationsSqlGeneratorDependencies dependencies)
{
Check.NotNull(dependencies, nameof(dependencies));
Expand Down Expand Up @@ -1641,7 +1637,7 @@ protected virtual void CheckConstraint(

builder
.Append("CHECK ");

builder.Append("(")
.Append(operation.ConstraintSql)
.Append(")");
Expand Down
13 changes: 8 additions & 5 deletions src/EFCore.Relational/Query/AsyncQueryMethodProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,15 @@ public void Dispose()
}

/// <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.
/// <para>
/// The <see cref="MethodInfo"/> of the internal `_InjectParameters` method exposed such
/// that it can be used when processing expression trees.
/// </para>
/// <para>
/// This type is typically used by database providers (and other extensions). It is generally
/// not used in application code.
/// </para>
/// </summary>
[EntityFrameworkInternal]
public virtual MethodInfo InjectParametersMethod => _injectParametersMethodInfo;

private static readonly MethodInfo _injectParametersMethodInfo
Expand Down
13 changes: 8 additions & 5 deletions src/EFCore.Relational/Query/QueryMethodProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,15 @@ var outer
}

/// <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.
/// <para>
/// The <see cref="MethodInfo"/> of the internal `_InjectParameters` method exposed such
/// that it can be used when processing expression trees.
/// </para>
/// <para>
/// This type is typically used by database providers (and other extensions). It is generally
/// not used in application code.
/// </para>
/// </summary>
[EntityFrameworkInternal]
public virtual MethodInfo InjectParametersMethod => _injectParametersMethodInfo;

private static readonly MethodInfo _injectParametersMethodInfo
Expand Down
Loading

0 comments on commit 32a7833

Please sign in to comment.