Skip to content
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

Fix HiLo for TPC #28547

Merged
merged 1 commit into from
Jul 30, 2022
Merged
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 @@ -156,7 +156,7 @@ protected override void ValidateValueGeneration(
{
foreach (var storeGeneratedProperty in key.Properties.Where(
p => (p.ValueGenerated & ValueGenerated.OnAdd) != 0
&& p.GetValueGenerationStrategy() != SqlServerValueGenerationStrategy.Sequence))
&& p.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn))
{
logger.TpcStoreGeneratedIdentityWarning(storeGeneratedProperty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ public virtual SqlServerSequenceValueGeneratorState GetOrAddSequenceState(
IProperty property,
IRelationalConnection connection)
{
var sequence = property.FindHiLoSequence(
StoreObjectIdentifier.Create(property.DeclaringEntityType, StoreObjectType.Table)!.Value);
var tableIdentifier = StoreObjectIdentifier.Create(property.DeclaringEntityType, StoreObjectType.Table);
var sequence = tableIdentifier != null
? property.FindHiLoSequence(tableIdentifier.Value)
: property.FindHiLoSequence();

Check.DebugAssert(sequence != null, "sequence is null");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.EntityFrameworkCore.Query;
public abstract class TPCInheritanceQueryTestBase<TFixture> : InheritanceQueryTestBase<TFixture>
where TFixture : TPCInheritanceQueryFixture, new()
{
public TPCInheritanceQueryTestBase(TFixture fixture)
protected TPCInheritanceQueryTestBase(TFixture fixture)
: base(fixture)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.EntityFrameworkCore.Query;

public class TPCInheritanceQueryHiLoSqlServerFixture : TPCInheritanceQuerySqlServerFixtureBase
{
protected override string StoreName
=> "TPCHiLoInheritanceTest";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
modelBuilder.UseHiLo();

base.OnModelCreating(modelBuilder, context);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.EntityFrameworkCore.Query;

public class TPCInheritanceQueryHiLoSqlServerTest : TPCInheritanceQuerySqlServerTestBase<TPCInheritanceQueryHiLoSqlServerFixture>
{
public TPCInheritanceQueryHiLoSqlServerTest(TPCInheritanceQueryHiLoSqlServerFixture fixture)
: base(fixture)
{
Fixture.TestSqlLoggerFactory.Clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

namespace Microsoft.EntityFrameworkCore.Query;

public class TPCInheritanceQuerySqlServerFixture : TPCInheritanceQueryFixture
public class TPCInheritanceQuerySqlServerFixture : TPCInheritanceQuerySqlServerFixtureBase
{
protected override ITestStoreFactory TestStoreFactory
=> SqlServerTestStoreFactory.Instance;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.EntityFrameworkCore.Query;

public abstract class TPCInheritanceQuerySqlServerFixtureBase : TPCInheritanceQueryFixture
{
protected override ITestStoreFactory TestStoreFactory
=> SqlServerTestStoreFactory.Instance;
}
Loading