-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Convert jsonDynamic to contentitem extension #16283
Conversation
@gvkries please review. |
I think it is beneficial to add support for a generic It would look like in this example: @foreach (var foo in Model.ContentItem.Content.NamedBagPart.ContentItems)
{
var contentItem = foo.ToObject<ContentItem>();
...
} Note that this is actually possible right now, but only when using the @foreach (var foo in Model.ContentItem.Content.NamedBagPart.ContentItems)
{
var contentItem = ((JsonObject)foo).ToObject<ContentItem>();
...
} We also have references to this style in the documentation, so we must fix it anyway IMHO.
It would just require something like |
I guess |
@gvkries feel free to make any changes. |
src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicObject.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemExtensions.cs
Outdated
Show resolved
Hide resolved
…micObject.cs Co-authored-by: Hisham Bin Ateya <hishamco_2007@yahoo.com>
…tentItemExtensions.cs Co-authored-by: Hisham Bin Ateya <hishamco_2007@yahoo.com>
I don't think I have access to your PR :) I will open another PR with a different approach. |
closing in favor of #16292 |
resolves #16233