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

Minor optimisation by passing int instead of int? to Umbraco.Content() #9669

Merged

Conversation

nzdev
Copy link
Contributor

@nzdev nzdev commented Jan 17, 2021

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes NA

Description

Minor optimisation by passing int instead of int? to Umbraco.Content.
Pass int to Umbraco.Content instead of int? given we know _contentId has value.

@Shazwazza Shazwazza added category/performance Fixes for performance (generally cpu or memory) fixes community/pr labels Jan 21, 2021
@Shazwazza Shazwazza merged commit 335c6b1 into umbraco:v8/contrib Jan 21, 2021
@@ -103,7 +103,7 @@ protected virtual void ConfigurePublishedContentRequest(PublishedRequest request
{
if (_contentId.HasValue)
{
var content = Umbraco.Content(_contentId);
var content = Umbraco.Content(_contentId.Value);
if (content == null)
{
throw new InvalidOperationException("Could not resolve content with id " + _contentId);
Copy link
Contributor

Choose a reason for hiding this comment

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

@nzdev @Shazwazza should it use _contentId.Value in InvalidOperationException as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's not going to have any perf impact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/performance Fixes for performance (generally cpu or memory) fixes community/pr release/8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants