-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make EvaluableExpressionFilter public
- Loading branch information
Showing
9 changed files
with
218 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/EFCore.Relational/Query/RelationalEvaluatableExpressionFilterDependencies.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// 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 JetBrains.Annotations; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Utilities; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Service dependencies parameter class for <see cref="RelationalEvaluatableExpressionFilter" /> | ||
/// </para> | ||
/// <para> | ||
/// This type is typically used by database providers (and other extensions). It is generally | ||
/// not used in application code. | ||
/// </para> | ||
/// <para> | ||
/// Do not construct instances of this class directly from either provider or application code as the | ||
/// constructor signature may change as new dependencies are added. Instead, use this type in | ||
/// your constructor so that an instance will be created and injected automatically by the | ||
/// dependency injection container. To create an instance with some dependent services replaced, | ||
/// first resolve the object from the dependency injection container, then replace selected | ||
/// services using the 'With...' methods. Do not call the constructor at any point in this process. | ||
/// </para> | ||
/// <para> | ||
/// The service lifetime is <see cref="ServiceLifetime.Scoped"/>. This means that each | ||
/// <see cref="DbContext"/> instance will use its own instance of this service. | ||
/// The implementation may depend on other services registered with any lifetime. | ||
/// The implementation does not need to be thread-safe. | ||
/// </para> | ||
/// </summary> | ||
public sealed class RelationalEvaluatableExpressionFilterDependencies | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Creates the service dependencies parameter object for a <see cref="RelationalEvaluatableExpressionFilter" />. | ||
/// </para> | ||
/// <para> | ||
/// Do not call this constructor directly from either provider or application code as it may change | ||
/// as new dependencies are added. Instead, use this type in your constructor so that an instance | ||
/// will be created and injected automatically by the dependency injection container. To create | ||
/// an instance with some dependent services replaced, first resolve the object from the dependency | ||
/// injection container, then replace selected services using the 'With...' methods. Do not call | ||
/// the constructor at any point in this process. | ||
/// </para> | ||
/// <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. | ||
/// </para> | ||
/// </summary> | ||
[EntityFrameworkInternal] | ||
public RelationalEvaluatableExpressionFilterDependencies([NotNull] IModel model) | ||
{ | ||
Check.NotNull(model, nameof(model)); | ||
|
||
Model = model; | ||
} | ||
|
||
/// <summary> | ||
/// The model used with this <see cref="RelationalEvaluatableExpressionFilter"/>. | ||
/// </summary> | ||
public IModel Model { get; } | ||
|
||
/// <summary> | ||
/// Clones this dependency parameter object with one service replaced. | ||
/// </summary> | ||
/// <param name="model"> A replacement for the current dependency of this type. </param> | ||
/// <returns> A new parameter object with the given service replaced. </returns> | ||
public RelationalEvaluatableExpressionFilterDependencies With([NotNull] IModel model) | ||
=> new RelationalEvaluatableExpressionFilterDependencies(model); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/EFCore/Query/EvaluatableExpressionFilterDependencies.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// 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 Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Service dependencies parameter class for <see cref="EvaluatableExpressionFilter" /> | ||
/// </para> | ||
/// <para> | ||
/// This type is typically used by database providers (and other extensions). It is generally | ||
/// not used in application code. | ||
/// </para> | ||
/// <para> | ||
/// Do not construct instances of this class directly from either provider or application code as the | ||
/// constructor signature may change as new dependencies are added. Instead, use this type in | ||
/// your constructor so that an instance will be created and injected automatically by the | ||
/// dependency injection container. To create an instance with some dependent services replaced, | ||
/// first resolve the object from the dependency injection container, then replace selected | ||
/// services using the 'With...' methods. Do not call the constructor at any point in this process. | ||
/// </para> | ||
/// <para> | ||
/// The service lifetime is <see cref="ServiceLifetime.Scoped"/>. This means that each | ||
/// <see cref="DbContext"/> instance will use its own instance of this service. | ||
/// The implementation may depend on other services registered with any lifetime. | ||
/// The implementation does not need to be thread-safe. | ||
/// </para> | ||
/// </summary> | ||
public sealed class EvaluatableExpressionFilterDependencies | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Creates the service dependencies parameter object for a <see cref="EvaluatableExpressionFilter" />. | ||
/// </para> | ||
/// <para> | ||
/// Do not call this constructor directly from either provider or application code as it may change | ||
/// as new dependencies are added. Instead, use this type in your constructor so that an instance | ||
/// will be created and injected automatically by the dependency injection container. To create | ||
/// an instance with some dependent services replaced, first resolve the object from the dependency | ||
/// injection container, then replace selected services using the 'With...' methods. Do not call | ||
/// the constructor at any point in this process. | ||
/// </para> | ||
/// <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. | ||
/// </para> | ||
/// </summary> | ||
[EntityFrameworkInternal] | ||
public EvaluatableExpressionFilterDependencies() | ||
{ | ||
} | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
src/EFCore/Query/Internal/EvaluatableExpressionFilterBase.cs
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
test/EFCore.Relational.Tests/Query/RelationalEvaluatableExpressionFilterDependenciesTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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 Microsoft.EntityFrameworkCore.TestUtilities; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class RelationalEvaluatableExpressionFilterDependenciesTest | ||
{ | ||
[ConditionalFact] | ||
public void Can_use_With_methods_to_clone_and_replace_service() | ||
{ | ||
RelationalTestHelpers.Instance.TestDependenciesClone<RelationalEvaluatableExpressionFilterDependencies>(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
test/EFCore.Tests/Query/EvaluatableExpressionFilterDependenciesTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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 Microsoft.EntityFrameworkCore.TestUtilities; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class EvaluatableExpressionFilterDependenciesTest | ||
{ | ||
[ConditionalFact] | ||
public void Can_use_With_methods_to_clone_and_replace_service() | ||
{ | ||
InMemoryTestHelpers.Instance.TestDependenciesClone<EvaluatableExpressionFilterDependencies>(); | ||
} | ||
} | ||
} |