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

Calling TemporalTableAll returns same record for each history entry #504

Open
szavoda opened this issue Sep 22, 2022 · 2 comments
Open

Calling TemporalTableAll returns same record for each history entry #504

szavoda opened this issue Sep 22, 2022 · 2 comments
Assignees

Comments

@szavoda
Copy link

szavoda commented Sep 22, 2022

Given a temporal table (azure sql) with 1 primary record and 2 history records. When using the extension "TemporalTableAll()" to get all historical records, the result set returns 3 records, but each record has the same row values (values are same as active record).

Switching to Enitty Framework built in TemporalAll() returns correct record set with value as expected.

@JonathanMagnan JonathanMagnan self-assigned this Sep 23, 2022
@JonathanMagnan
Copy link
Member

Hello @szavoda ,

Thank you for reporting,

We will look at it.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @szavoda ,

We indeed have the issue, but it was initially coded this way as the method requires the AsNoTracking for not getting tracked and have a different value (Otherwise, the change tracked do what it should do and return the entity tracked for the same id).

You will not get longer get the same record issue by using AsNoTracking like this:

var list2 = context.EntitySimples.AsNoTracking().TemporalTableAll().ToList();

We are currently in discussion to see if we should change the behavior or not. We did it initially this way as we thought it was not our job to decide what should be tracked and what should not be tracked (probably a mistake here).

One thing we will also look is if we should simply remove those extensions for recent version of EF Core. Better using their method that our method if they do all what we are doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants