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

ResponseFactory: Add a response factory to the public API #1453

Merged
merged 7 commits into from
May 2, 2020

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Apr 30, 2020

Pull Request Template

Description

This change refactors and exposes a factory to create the item and feed responses. This allows users to create the responses which is necessary if users want to create a custom wrapper for the container abstraction.

ItemResponse<Book> itemResponse = this.cosmosClient.ResponseFactory.CreateItemResponse<Book>(responseMessage);
public abstract CosmosResponseFactory
internal abstract CosmosResponseFactoryInternal : CosmosResponseFactory
internal sealed CosmosResponseFactoryCore : CosmosResponseFactoryInternal

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

@j82w j82w added the feature-request New feature or request label Apr 30, 2020
@j82w j82w self-assigned this Apr 30, 2020
@j82w j82w requested a review from anujtoshniwal April 30, 2020 17:45
@ealsur
Copy link
Member

ealsur commented Apr 30, 2020

This uses the default serializer, correct? So users with a custom one would still need to do it on their end.

If it uses the default serializer, can we explain more why would you use this versus just calling the Type APIs? Sounds like it's a very specific scenario.

Copy link
Contributor

@anujtoshniwal anujtoshniwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the ResponseFactory is exposed on CosmosClient, for Encryption we'd need to take in the client also as input apart from the Container. Can we avoid this by either exposing it on Container or else have a reverse traversal mechanism from Container up?

kirankumarkolli
kirankumarkolli previously approved these changes May 1, 2020
ealsur
ealsur previously approved these changes May 1, 2020
Microsoft.Azure.Cosmos/src/CosmosClient.cs Outdated Show resolved Hide resolved
@j82w j82w dismissed stale reviews from ealsur and kirankumarkolli via d1188dd May 1, 2020 21:44
@j82w j82w merged commit 4284091 into master May 2, 2020
@j82w j82w deleted the users/jawilley/encryption/requestFactory branch May 2, 2020 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants