Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
Removed unnecessary usings
Renamed extension method classes causing naming conflicts with MS classes
  • Loading branch information
Adam-Langley committed Jun 6, 2020
1 parent e2e828b commit 8b682ca
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
8 changes: 1 addition & 7 deletions src/EFCore.Temporal.Query/AsOfQuerySqlGeneratorFactory.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal;

namespace EntityFrameworkCore.TemporalTables.Query
{
public class AsOfQuerySqlGeneratorFactory : IQuerySqlGeneratorFactory
{
private readonly IQueryableMethodTranslatingExpressionVisitorFactory _ss;
private readonly QuerySqlGeneratorDependencies _dependencies;
private readonly ISqlServerOptions _sqlServerOptions;
private readonly QueryCompilationContext _queryCompilationContext;

public AsOfQuerySqlGeneratorFactory(
[NotNull] QuerySqlGeneratorDependencies dependencies,
[NotNull] ISqlServerOptions sqlServerOptions)
[NotNull] QuerySqlGeneratorDependencies dependencies)
{
_dependencies = dependencies;
_sqlServerOptions = sqlServerOptions;
}

public QuerySqlGenerator Create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Temporal.Query.Extensions.Internal;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;

namespace EntityFrameworkCore.TemporalTables.Query
Expand Down Expand Up @@ -62,11 +61,11 @@ protected override QueryableMethodTranslatingExpressionVisitor CreateSubqueryVis

protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression)
{
if (methodCallExpression.Method.DeclaringType == typeof(SqlServerQueryableExtensions))
if (methodCallExpression.Method.DeclaringType == typeof(SqlServerAsOfQueryableExtensions))
{
switch (methodCallExpression.Method.Name)
{
case nameof(SqlServerQueryableExtensions.AsOf):
case nameof(SqlServerAsOfQueryableExtensions.AsOf):
// capture the date parameter for use by all AsOfTableExpression instances
_asOfDateParameter = Visit(methodCallExpression.Arguments[1]) as ParameterExpression;
return Visit(methodCallExpression.Arguments[0]);
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Temporal.Query/AsOfSqlExpressionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public AsOfSqlExpressionFactory(SqlExpressionFactoryDependencies dependencies) :

public override SelectExpression Select(IEntityType entityType)
{
if (entityType.FindAnnotation(SqlServerEntityTypeBuilderExtensions.ANNOTATION_TEMPORAL) != null)
if (entityType.FindAnnotation(SqlServerAsOfEntityTypeBuilderExtensions.ANNOTATION_TEMPORAL) != null)
{
var asOfTableExpression = new AsOfTableExpression(
entityType.GetTableName(),
Expand Down
3 changes: 1 addition & 2 deletions src/EFCore.Temporal.Query/AsOfTableExpression.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using System;
using System.Linq.Expressions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Microsoft.EntityFrameworkCore
{
public static class SqlServerEntityTypeBuilderExtensions
public static class SqlServerAsOfEntityTypeBuilderExtensions
{
public static string ANNOTATION_TEMPORAL = "IS_TEMPORAL_TABLE";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
namespace Microsoft.EntityFrameworkCore
{

public static class SqlServerQueryableExtensions
public static class SqlServerAsOfQueryableExtensions
{
public static readonly MethodInfo AsOfMethodInfo
= typeof(SqlServerQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(AsOf));
= typeof(SqlServerAsOfQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(AsOf));

/// <summary>
/// Configure a query to constrain all temporal tables to a specific time
Expand Down

0 comments on commit 8b682ca

Please sign in to comment.