Skip to content

Commit

Permalink
Rename SlimModel to RuntimeModel.
Browse files Browse the repository at this point in the history
Perform other refactorings.

Part of #24743
  • Loading branch information
AndriySvyryd committed May 4, 2021
1 parent 470e45c commit 8556358
Show file tree
Hide file tree
Showing 37 changed files with 412 additions and 408 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.InMemory.Diagnostics.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Internal;
using Microsoft.EntityFrameworkCore.InMemory.Metadata.Conventions;
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 @@ -862,7 +862,7 @@ public static OwnedNavigationBuilder<TEntity, TRelatedEntity> ToFunction<TEntity
var model = entityType.Model;
var function = name is not null
? model.FindDbFunction(name) ?? model.AddDbFunction(
name, typeof(IQueryable<>).MakeGenericType(entityType.ClrType ?? typeof(Dictionary<string, object>)))
name, typeof(IQueryable<>).MakeGenericType(entityType.ClrType))
: null;

return function;
Expand Down
18 changes: 8 additions & 10 deletions src/EFCore.Relational/Extensions/RelationalModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ public static IEnumerable<IReadOnlySequence> GetSequences(this IReadOnlyModel mo
/// <param name="name"> The model name of the function. </param>
/// <returns> The function or <see langword="null" /> if the method is not mapped. </returns>
public static IReadOnlyDbFunction? FindDbFunction(this IReadOnlyModel model, string name)
=> DbFunction.FindDbFunction(
Check.NotNull(model, nameof(model)),
Check.NotNull(name, nameof(name)));
=> DbFunction.FindDbFunction(model, Check.NotNull(name, nameof(name)));

/// <summary>
/// Finds a function that is mapped to the method represented by the given name.
Expand All @@ -329,7 +327,7 @@ public static IEnumerable<IReadOnlySequence> GetSequences(this IReadOnlyModel mo
/// <param name="name"> The model name of the function. </param>
/// <returns> The function or <see langword="null" /> if the method is not mapped. </returns>
public static IMutableDbFunction? FindDbFunction(this IMutableModel model, string name)
=> (IMutableDbFunction?)((IModel)model).FindDbFunction(name);
=> (IMutableDbFunction?)((IReadOnlyModel)model).FindDbFunction(name);

/// <summary>
/// Finds a function that is mapped to the method represented by the given name.
Expand All @@ -338,7 +336,7 @@ public static IEnumerable<IReadOnlySequence> GetSequences(this IReadOnlyModel mo
/// <param name="name"> The model name of the function. </param>
/// <returns> The function or <see langword="null" /> if the method is not mapped. </returns>
public static IConventionDbFunction? FindDbFunction(this IConventionModel model, string name)
=> (IConventionDbFunction?)((IModel)model).FindDbFunction(name);
=> (IConventionDbFunction?)((IReadOnlyModel)model).FindDbFunction(name);

/// <summary>
/// Finds a function that is mapped to the method represented by the given name.
Expand Down Expand Up @@ -455,29 +453,29 @@ public static IConventionDbFunction AddDbFunction(
/// Returns all functions contained in the model.
/// </summary>
/// <param name="model"> The model to get the functions in. </param>
public static IEnumerable<IReadOnlyDbFunction> GetDbFunctions(this IModel model)
public static IEnumerable<IReadOnlyDbFunction> GetDbFunctions(this IReadOnlyModel model)
=> DbFunction.GetDbFunctions(Check.NotNull(model, nameof(model)));

/// <summary>
/// Returns all functions contained in the model.
/// </summary>
/// <param name="model"> The model to get the functions in. </param>
public static IEnumerable<IMutableDbFunction> GetDbFunctions(this IMutableModel model)
=> DbFunction.GetDbFunctions((Model)Check.NotNull(model, nameof(model))).Cast<IMutableDbFunction>();
=> DbFunction.GetDbFunctions(Check.NotNull(model, nameof(model))).Cast<IMutableDbFunction>();

/// <summary>
/// Returns all functions contained in the model.
/// </summary>
/// <param name="model"> The model to get the functions in. </param>
public static IEnumerable<IConventionDbFunction> GetDbFunctions(this IConventionModel model)
=> DbFunction.GetDbFunctions((Model)Check.NotNull(model, nameof(model))).Cast<IConventionDbFunction>();
=> DbFunction.GetDbFunctions(Check.NotNull(model, nameof(model))).Cast<IConventionDbFunction>();

/// <summary>
/// Returns all functions contained in the model.
/// </summary>
/// <param name="model"> The model to get the functions in. </param>
public static IEnumerable<IDbFunction> GetDbFunctions(this IReadOnlyModel model)
=> DbFunction.GetDbFunctions((Model)Check.NotNull(model, nameof(model)));
public static IEnumerable<IDbFunction> GetDbFunctions(this IModel model)
=> DbFunction.GetDbFunctions(Check.NotNull(model, nameof(model)));

/// <summary>
/// Returns the database collation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public override ConventionSet CreateConventionSet()

ReplaceConvention(
conventionSet.ModelFinalizedConventions,
(SlimModelConvention)new RelationalSlimModelConvention(Dependencies, RelationalDependencies));
(RuntimeModelConvention)new RelationalRuntimeModelConvention(Dependencies, RelationalDependencies));

return conventionSet;
}
Expand Down
Loading

0 comments on commit 8556358

Please sign in to comment.