-
Notifications
You must be signed in to change notification settings - Fork 19
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
Added AsOf and Between extension methods on a DbSet. #10
Conversation
Your extensions will only return data from the TemporalTable instead of the history table. |
Did you test the extension? Data from both tables is returned with this syntax. Maybe I don't understand what you mean, but I'd you test both extensions, days from the main table and history table is returned if it matches the date. |
@lpperras Sorry i've mistaken, take a look at my test results |
Hi, I've checked your pull request and it appears to be working so I merged it. I still can't find a solution for that problem but meanwhile your solution will work for maybe most of the cases so thank you for cooperating on the project! |
I would have to try, but I think that since the FromRawSql method returns an IQueryable, doing this: Only selected columns would be returned from the database. |
Just noticed that you changed the type from DateTimeOffset to DateTime. Since Temporal tables are datetime2 columns, I had timezone issues when using DateTime. It would not work properly if my timezone wasn't GMT. Maybe my tests were not valid, did you try with different timezones? |
Yes, I've tested that it and it only fetches the specified columns when I apply a |
I guess we can overload the methods to support both DateTime and DateTimeOffset, I wasn't sure why you need DateTimeOffset initially. When I work with time zones I store the dates in UTC and have the corresponding client applications convert the UTC dates to their local date & time and I'm able to achieve complete independence of the time zone my database is being hosted in. I'll modify the library to support |
Agree with your approach
I don't think you should support |
You are right that the underlying type is always Ex: |
Added some simple extension methods on a DbSet to easily query a entities at a specific time or between a range. The returned IQueryable can still be used by suppoted EF LINQ operators and the filter will apply fine.