mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-23 23:20:51 +01:00
Add constructor parameters for optional entity properties #1698
Labels
No labels
area:database
awaiting-feedback
backend
blocked
breaking change: web api
bug
build
ci
confirmed
discussion needed
dotnet future
downstream
duplicate
EFjellyfin.db
enhancement
feature
future
github-actions
good first issue
hdr
help wanted
invalid
investigation
librarydb
live-tv
lyrics
media playback
music
needs testing
nuget
performance
platform
pull-request
question
regression
release critical
requires-web
roadmap
security
security
stale
support
syncplay
ui & ux
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: starred/jellyfin#1698
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mark-monteiro on GitHub (May 15, 2020).
As discussed here , we should consider updating the new EF models to include all properties as constructor parameters, instead of only the required properties as is now.
This would prevent having to instantiate new instances like this, which is a bit ugly:
and instead you could write this:
Adding the
discussion neededtag to get some feedback on whether this is a desired change.@barronpm commented on GitHub (May 20, 2020):
I'm against this, because for the more complicated entities, we would need over 20 optional parameters in a constructor, which I don't think would be ideal. Instead, I think we should try to limit constructor parameters to what is both required and has no default value.
@barronpm commented on GitHub (Jun 4, 2020):
This I think will be a good solution when we move to .NET 5: https://devblogs.microsoft.com/dotnet/welcome-to-c-9-0/#init-only-properties
@edrohler commented on GitHub (Jun 4, 2021):
Hi all. Is this still being discussed? I think it has overlap with 3122.
@mark-monteiro commented on GitHub (Jun 14, 2021):
I don't think any relevant changes have been made so yeah, I think this is still up for discussion.
Now that we're using .NET 5, I think @barronpm is right in that init-only properties is the way to go.