You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the sdk I've noticed some code that we end up repeating pretty often around References, like having to create a new reference to request a language variant of a content item that I already have, or checking agaisnt Guid.Empty when I want to filter if the items are in the default language/workflow...
Proposed solution
Add a static Default method to Reference class (will return a Reference instance with Guid.Empty id and default codename)
Implement IEquatable to Reference class
Add Implicit conversor from sdk models (ContentItemModel, LanguageVariantModel...) to Reference
Additional context
The text was updated successfully, but these errors were encountered:
hello Diego, pardon the late reply. I'll check with wider team which of your proposed solutions is preferred and get back to you soon, thanks for your patience.
I'd say the best approach is indeed to have a static method to create a default reference, e.g.:
/// <summary>/// Creates the reference by empty guid (for entities with default ID)./// </summary>publicstatic Reference ByDefaultId()=>new(){Id= Guid.Empty };
I'm not sure a similar implementation for default codename is necessary. IDs are immutable, whereas codenames can be modified. all default entities come with an empty ID if I'm not mistaken, so I think above method should be sufficient.
do you have a use case for default codename as well?
Motivation
Using the sdk I've noticed some code that we end up repeating pretty often around References, like having to create a new reference to request a language variant of a content item that I already have, or checking agaisnt Guid.Empty when I want to filter if the items are in the default language/workflow...
Proposed solution
Additional context
The text was updated successfully, but these errors were encountered: