Skip to content

.net 5 migration (partial) #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ protected AsOfQueryableMethodTranslatingExpressionVisitor(
public AsOfQueryableMethodTranslatingExpressionVisitor(
QueryableMethodTranslatingExpressionVisitorDependencies dependencies,
RelationalQueryableMethodTranslatingExpressionVisitorDependencies relationalDependencies,
IModel model,
QueryCompilationContext queryCompilationContext,
ParameterExpression asOfDateParameter = null
) : base(dependencies, relationalDependencies, model)
) : base(dependencies, relationalDependencies, queryCompilationContext)
{
_relationalDependencies = relationalDependencies;
_model = model;
_model = queryCompilationContext.Model;
_asOfDateParameter = asOfDateParameter;

var sqlExpressionFactory = relationalDependencies.SqlExpressionFactory;
Expand All @@ -53,6 +53,7 @@ protected override Expression VisitConstant(ConstantExpression constantExpressio
// attempt to apply the captured date parameter to any select-from-table expressions
shapedExpression.TrySetDateParameter(_asOfDateParameter);
}

return result;
}

Expand All @@ -75,4 +76,4 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
return base.VisitMethodCall(methodCallExpression);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

namespace EntityFrameworkCore.TemporalTables.Query
{
public class AsOfQueryableMethodTranslatingExpressionVisitorFactory : IQueryableMethodTranslatingExpressionVisitorFactory
public class
AsOfQueryableMethodTranslatingExpressionVisitorFactory : IQueryableMethodTranslatingExpressionVisitorFactory
{
private readonly QueryableMethodTranslatingExpressionVisitorDependencies _dependencies;
private readonly RelationalQueryableMethodTranslatingExpressionVisitorDependencies _relationalDependencies;
Expand All @@ -15,9 +16,11 @@ public AsOfQueryableMethodTranslatingExpressionVisitorFactory(
_dependencies = dependencies;
_relationalDependencies = relationalDependencies;
}
public QueryableMethodTranslatingExpressionVisitor Create(IModel model)

public QueryableMethodTranslatingExpressionVisitor Create(QueryCompilationContext queryCompilationContext)
{
return new AsOfQueryableMethodTranslatingExpressionVisitor(_dependencies, _relationalDependencies, model);
return new AsOfQueryableMethodTranslatingExpressionVisitor(_dependencies, _relationalDependencies,
queryCompilationContext);
}
}
}
}
9 changes: 5 additions & 4 deletions src/EFCore.Temporal.Query/AsOfTableExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class AsOfTableExpression : TableExpressionBase
{
public string Name { get; }
public string Schema { get; }

/// <summary>
/// Gets and sets the parameter used to constrain a query to a specific temporal period.
/// </summary>
Expand All @@ -24,7 +25,7 @@ public AsOfTableExpression(string name, string schema, string alias) : base(alia
Schema = schema;
}

public override void Print(ExpressionPrinter expressionPrinter)
protected override void Print(ExpressionPrinter expressionPrinter)
{
if (!string.IsNullOrEmpty(Schema))
{
Expand All @@ -35,9 +36,9 @@ public override void Print(ExpressionPrinter expressionPrinter)
}

public override bool Equals(object obj)
// This should be reference equal only.
=> obj != null && ReferenceEquals(this, obj);
// This should be reference equal only.
=> obj != null && ReferenceEquals(this, obj);

public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Name, Schema);
}
}
}
8 changes: 4 additions & 4 deletions src/EFCore.Temporal.Query/EFCore.Temporal.Query.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<MinClientVersion>3.6</MinClientVersion>
<AssemblyName>Dabble.EntityFrameworkCore.Temporal.Query</AssemblyName>
<RootNamespace>Microsoft.EntityFrameworkCore.Temporal.Query</RootNamespace>
Expand All @@ -26,9 +26,9 @@ https://www.flaticon.com/authors/smashicons</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.1" />
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down