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

TPT issues update command when replacing dependent with derived #21497

Closed
smitpatel opened this issue Jul 2, 2020 · 1 comment · Fixed by #21542
Closed

TPT issues update command when replacing dependent with derived #21497

smitpatel opened this issue Jul 2, 2020 · 1 comment · Fixed by #21542
Labels
area-save-changes closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@smitpatel
Copy link
Contributor

Test - TPTTableSplittingTestBase.Can_change_dependent_instance_non_derived

Vehicle -> Operator both are mapped to Vehicles
LicensedOperator is mapped to LicensedOperators

var bike = context.Vehicles.Include(v => v.Operator).Single(v => v.Name == "Trek Pro Fit Madone 6 Series");
// bike.Operator is of type Operator with Name "Lance Armstrong"
bike.Operator = new Operator { Name = "Chris Horner" };

context.ChangeTracker.DetectChanges();

bike.Operator = new LicensedOperator { Name = "repairman", LicenseType = "Repair" };

TestSqlLoggerFactory.Clear();
context.SaveChanges();

Issues following commands in update pipeline

exec sp_executesql N'SET NOCOUNT ON;
UPDATE [Vehicles] SET [Operator_Name] = @p0
WHERE [Name] = @p1;
SELECT [RequiredInt]
FROM [Vehicles]
WHERE @@ROWCOUNT = 1 AND [Name] = @p1;

',N'@p1 nvarchar(450),@p0 nvarchar(4000)',@p1=N'Trek Pro Fit Madone 6 Series',@p0=N'repairman'

exec sp_executesql N'SET NOCOUNT ON;
UPDATE [LicensedOperators] SET [LicenseType] = @p2
WHERE [VehicleName] = @p3;
SELECT @@ROWCOUNT;

',N'@p3 nvarchar(450),@p2 nvarchar(4000)',@p3=N'Trek Pro Fit Madone 6 Series',@p2=N'Repair'

2nd fails because it should add a new row not update.

@smitpatel
Copy link
Contributor Author

Skipped 2 more tests.
3rd test is not issuing delete command on derived table.

@ajcvickers ajcvickers added this to the 5.0.0 milestone Jul 6, 2020
@AndriySvyryd AndriySvyryd removed their assignment Jul 7, 2020
AndriySvyryd added a commit that referenced this issue Jul 7, 2020
Fix TPT commands order for delete

Fixes #21497
@AndriySvyryd AndriySvyryd added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 7, 2020
AndriySvyryd added a commit that referenced this issue Jul 7, 2020
Fix TPT commands order for delete

Fixes #21497
AndriySvyryd added a commit that referenced this issue Jul 7, 2020
Fix TPT commands order for delete

Fixes #21497
@ghost ghost closed this as completed in #21542 Jul 8, 2020
ghost pushed a commit that referenced this issue Jul 8, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0, 5.0.0-preview8 Jul 14, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0-preview8, 5.0.0 Nov 7, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-save-changes closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants