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

Add BoxConfigBuilder and make BoxConfig immutable #737

Merged
merged 5 commits into from
Aug 6, 2021

Conversation

mwwoda
Copy link
Contributor

@mwwoda mwwoda commented Jul 28, 2021

I created BoxConfigBuilder to make it easier to create new BoxConfig (fluent builder, used in .NET Core to build configuration so .NET devs should be familiar with this).

At the same time BoxConfig was made immutable. I could also remove constructors from BoxConfig, but it would make it more 'breaking' that it is at the moment. To be discussed.

Hide setters in BoxConfig and make it immutable
@mwwoda mwwoda linked an issue Jul 28, 2021 that may be closed by this pull request
@mwwoda mwwoda requested review from mhagmajer and PJSimon July 28, 2021 15:17
public virtual Uri BoxAccountApiHostUri { get; set; } = new Uri(Constants.BoxAccountApiHostUriString);
public virtual Uri BoxApiUri { get; set; } = new Uri(Constants.BoxApiUriString);
public virtual Uri BoxUploadApiUri { get; set; } = new Uri(Constants.BoxUploadApiUriString);
public Uri BoxApiHostUri { get; private set; } = new Uri(Constants.BoxApiHostUriString);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why all the virtual methods in BoxConfig? Where were they being overridden? Why can the be made not virtual now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They were not overridden anywhere in our SDK. If we expose IBoxConfig it could be used instead so there is no value for having virtual properties there (also the class is now sealed so it could not be derived from). See also explanation in #401.

@mwwoda mwwoda merged commit 1e32d4e into main Aug 6, 2021
@mwwoda mwwoda deleted the sdk-1716-boxconfig-immutable branch August 6, 2021 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make BoxConfig sealed and immutable
2 participants