-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add Cosmos db manual session token management #37027
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
Draft
JoasE
wants to merge
25
commits into
dotnet:main
Choose a base branch
from
JoasE:feature/#36504-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,099
−138
Draft
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2853acc
WIP
JoasE e374631
Wip: merge session tokens
JoasE f295ce9
WIP..
JoasE ad8d930
Make Client responsible
JoasE 3a3a510
add todo
JoasE 691aa79
Cleanup and small improvements
JoasE c4a9977
Cleanup and small improvements
JoasE ac5ca96
Add option ManualSessionTokenManagementEnabled
JoasE 6f84317
fix no etag sessiontoken match
JoasE 64ab888
Add some testcases
JoasE dadc58b
Cleanup
JoasE 57f1f37
Add todo
JoasE fc8a580
Fix empty tokens
JoasE 364d0f4
Rename var
JoasE c9890e1
Remove some todos
JoasE 255bbe2
Move to non-parsing session token management
JoasE 87e0dfd
Revert "Add option ManualSessionTokenManagementEnabled"
JoasE df5809e
Cleanup
JoasE 2c29285
Cleanup
JoasE 77a81a3
Add tests for pr comment changes (pooling and query compilation vs ex…
JoasE 81e137c
Clear session token storage on reset
JoasE 0c62cee
Store session token storage in query context instead of compilation c…
JoasE 5c80637
Add todo
JoasE 1f8d6a9
Move to non-parsing but only composing session tokens
JoasE e729af3
Readd option ManualSessionTokenManagementEnabled
JoasE File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -147,6 +147,10 @@ | |||||
| <data name="ContainerContainingPropertyConflict" xml:space="preserve"> | ||||||
| <value>The entity type '{entityType}' is mapped to the container '{container}' but it is also configured as being contained in property '{property}'.</value> | ||||||
| </data> | ||||||
| <data name="ContainerNameDoesNotExist" xml:space="preserve"> | ||||||
| <value>The container with the name '{containerName}' does not exist.</value> | ||||||
| <comment>string</comment> | ||||||
| </data> | ||||||
| <data name="ContainerNotOnRoot" xml:space="preserve"> | ||||||
| <value>An Azure Cosmos DB container name is defined on entity type '{entityType}', which inherits from '{baseEntityType}'. Container names must be defined on the root entity type of a hierarchy.</value> | ||||||
| </data> | ||||||
|
|
@@ -171,6 +175,9 @@ | |||||
| <data name="ElementWithValueConverter" xml:space="preserve"> | ||||||
| <value>The property '{propertyType} {structuralType}.{property}' has element type '{elementType}', which requires a value converter. Elements types requiring value converters are not currently supported with the Azure Cosmos DB database provider.</value> | ||||||
| </data> | ||||||
| <data name="EnableManualSessionTokenManagement" xml:space="preserve"> | ||||||
| <value>Enable manual session token management using CosmosDbContextOptionsBuilder.ManualSessionTokenManagementEnabled to use this method.</value> | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| </data> | ||||||
| <data name="ETagNonStringStoreType" xml:space="preserve"> | ||||||
| <value>The type of the etag property '{property}' on '{entityType}' is '{propertyType}'. All etag properties must be strings or have a string value converter.</value> | ||||||
| </data> | ||||||
|
|
@@ -350,6 +357,9 @@ | |||||
| <data name="SaveChangesAutoTransactionBehaviorAlwaysTriggerAtomicity" xml:space="preserve"> | ||||||
| <value>When using AutoTransactionBehavior.Always with the Cosmos DB provider, only 1 entity can be saved at a time when using pre- or post- triggers to ensure atomicity.</value> | ||||||
| </data> | ||||||
| <data name="SessionTokenCanNotBeWhiteSpace" xml:space="preserve"> | ||||||
| <value>Session token can not be white space.</value> | ||||||
| </data> | ||||||
| <data name="SingleFirstOrDefaultNotSupportedOnNonNullableQueries" xml:space="preserve"> | ||||||
| <value>SingleOrDefault and FirstOrDefault cannot be used Cosmos SQL does not allow Offset without Limit. Consider specifying a 'Take' operation on the query.</value> | ||||||
| </data> | ||||||
|
|
||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SessionTokenStorage I want to check whether the container exists if a user is appending or adding a session token. It felt expensive to do GetContainerNames every DbContext instantiation, while I felt it could be a property of the model. However, I am not sure if annotations are the right way to add this data to the model for the cosmos provider. I am also not sure what would be the best place to calculate this metadata and set the annotation. Doing this this way fails CompiledModelCosmosTests and I am not sure if there is actually something wrong or the test should change and if so how.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndriySvyryd or @roji Could you provide some guidance on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the above proposed design you shouldn't need this