Make GetByIds in ContentService extensions non nullable#15736
Make GetByIds in ContentService extensions non nullable#15736nul800sebastiaan merged 7 commits intoumbraco:v14/devfrom
GetByIds in ContentService extensions non nullable#15736Conversation
|
Hi there @bjarnef, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
|
Not sure if it can be removed in v14 though or should it mention when is intended to be removed? Most obsolete methods mention v13, v14 etc. But searching the codebase it isn't really consistent https://github.com/search?q=repo%3Aumbraco%2FUmbraco-CMS%20obsolete&type=code It wonder if it is possible to extend Otherwise agree on a consistent format to include version. It was a bit off-topic for changes in this PR :) |
There was a problem hiding this comment.
I'm not sure what you're trying to achieve in terms of making things "consistent", but the nullability in the code is correct as it stands and shouldn't be changed just because other related methods happen to be nullable.
The point of nullable reference types is so that developers consuming our code can know at compile-time what references can and cannot be null and avoid unnecessary null checks.
src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CreatedPackageSchemaRepository.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CreatedPackageSchemaRepository.cs
Outdated
Show resolved
Hide resolved
|
Well it media can't be nullable, how can content be then? The extensions are pretty much doing the same thing looking up content/media from cache. Content Umbraco-CMS/src/Umbraco.Core/Services/IContentService.cs Lines 100 to 108 in a7cacc9 Media Umbraco-CMS/src/Umbraco.Core/Services/IMediaService.cs Lines 19 to 21 in a7cacc9 At a second look, it should probably be the Now we also have these, which are both non-nullable: as these both call the underlying |
Co-authored-by: Jason Elkin <jasonelkin86@gmail.com>
Co-authored-by: Jason Elkin <jasonelkin86@gmail.com>
…CreatedPackageSchemaRepository.cs Co-authored-by: Jason Elkin <jasonelkin86@gmail.com>
GetByIds in ContentService extensions non nullable
I think that's it @bjarnef - looking at the commit history, the nullability of the service was changed more recently and the extension method hasn't been updated to match. |
…CreatedPackageSchemaRepository.cs Co-authored-by: Jason Elkin <jasonelkin86@gmail.com>
|
Yes :) regarding the |
|
All good now, thanks for this one @bjarnef! 👍 |
Prerequisites
Description
In this PR #15289 I noticed
GetByIds()extensions forIContentServiceandIMediaServicewasn't consistent.I have changes this for v14 and at the same time I noticed redundant and inconsistency or
PackageMedia()method. Ideally this method should be moved, so it isn't duplicated and since it isprivateat both usage.