Skip to content

Commit

Permalink
Move IRelationalModel extension methods to the interfaces
Browse files Browse the repository at this point in the history
Rename SingletonModelDependencies to RuntimeModelDependencies
Rename GetEntityTypes(Type) to FindEntityTypes(Type)
Rename FindPrincipals() to GetPrincipals()
Remove IModelCreationDependencies

Fixes #19213
  • Loading branch information
AndriySvyryd committed Feb 20, 2021
1 parent 7dada2a commit 9b577a4
Show file tree
Hide file tree
Showing 117 changed files with 1,600 additions and 2,060 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ namespace Microsoft.EntityFrameworkCore
/// </summary>
public static class RelationalEntityTypeExtensions
{
/// <summary>
/// Gets the name used for the <see cref="ISqlQuery" /> mapped using
/// <see cref="M:RelationalEntityTypeBuilderExtensions.ToSqlQuery" />.
/// </summary>
public static readonly string DefaultQueryNameBase = "MappedSqlQuery";

/// <summary>
/// Returns the name of the table to which the entity type is mapped
/// or <see langword="null" /> if not mapped to a table.
Expand Down Expand Up @@ -432,7 +438,7 @@ public static IEnumerable<IViewMapping> GetViewMappings([NotNull] this IEntityTy
/// <param name="entityType"> The entity type. </param>
/// <returns> Gets the default SQL query name. </returns>
public static string GetDefaultSqlQueryName([NotNull] this IReadOnlyEntityType entityType)
=> entityType.Name + "." + SqlQueryExtensions.DefaultQueryNameBase;
=> entityType.Name + "." + DefaultQueryNameBase;

/// <summary>
/// Returns the SQL string used to provide data for the entity type or <see langword="null" /> if not mapped to a SQL string.
Expand Down
63 changes: 0 additions & 63 deletions src/EFCore.Relational/Extensions/RelationalModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Utilities;
Expand All @@ -22,67 +20,6 @@ namespace Microsoft.EntityFrameworkCore
/// </summary>
public static class RelationalModelExtensions
{
/// <summary>
/// <para>
/// Creates a human-readable representation of the given metadata.
/// </para>
/// <para>
/// Warning: Do not rely on the format of the returned string.
/// It is designed for debugging only and may change arbitrarily between releases.
/// </para>
/// </summary>
/// <param name="model"> The metadata item. </param>
/// <param name="options"> Options for generating the string. </param>
/// <param name="indent"> The number of indent spaces to use before each new line. </param>
/// <returns> A human-readable representation. </returns>
public static string ToDebugString(
[NotNull] this IRelationalModel model,
MetadataDebugStringOptions options,
int indent = 0)
{
var builder = new StringBuilder();
var indentString = new string(' ', indent);

builder.Append(indentString).Append("RelationalModel: ");

if (model.Collation != null)
{
builder.AppendLine().Append(indentString).Append("Collation: " + model.Collation);
}

foreach (var table in model.Tables)
{
builder.AppendLine().Append(table.ToDebugString(options, indent + 2));
}

foreach (var view in model.Views)
{
builder.AppendLine().Append(view.ToDebugString(options, indent + 2));
}

foreach (var function in model.Functions)
{
builder.AppendLine().Append(function.ToDebugString(options, indent + 2));
}

foreach (var query in model.Queries)
{
builder.AppendLine().Append(query.ToDebugString(options, indent + 2));
}

foreach (var sequence in model.Sequences)
{
builder.AppendLine().Append(sequence.ToDebugString(options, indent + 2));
}

if ((options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
{
builder.Append(model.AnnotationsToDebugString(indent));
}

return builder.ToString();
}

/// <summary>
/// Returns the default schema to use for the model, or <see langword="null" /> if none has been set.
/// </summary>
Expand Down
58 changes: 0 additions & 58 deletions src/EFCore.Relational/Metadata/CheckConstraintExtensions.cs

This file was deleted.

69 changes: 0 additions & 69 deletions src/EFCore.Relational/Metadata/ColumnExtensions.cs

This file was deleted.

65 changes: 0 additions & 65 deletions src/EFCore.Relational/Metadata/ColumnMappingExtensions.cs

This file was deleted.

76 changes: 0 additions & 76 deletions src/EFCore.Relational/Metadata/DbFunctionExtensions.cs

This file was deleted.

Loading

0 comments on commit 9b577a4

Please sign in to comment.