Drop Newtonsoft.Json support, GovTech company case study - This week in Orchard (01/03/2024)

Gábor Domonkos's avatar
Announcement, Documentation, This week in Orchard, GraphQL

GraphQL query for retrieving current user data and its custom settings, drop Newtonsoft.Json support, and a GovTech company case study are the topics for this week! Without further ado, let's get started!

Orchard Core updates

GraphQL query for retrieving current user data and its custom settings

Getting information about the current user and additionally its custom user settings (aka user profile) was not possible out of the box with GraphQL. A query would be handy for using Orchard Core as a headless CMS with front-end users. This can also allow querying custom user settings (i.e., content types with the CustomUserSettings stereotype).

So, from now on, there is a new GraphQL object to export for the current user. It gives you your own information and custom settings if you are authenticated. To try this out, you have to enable the GraphQL feature, and after that, you can use a query which you can see in the screen below by using the GraphiQL Explorer.

GraphQL query for retrieving current user data

Drop Newtonsoft.Json Support

The utilization of Newtonsoft.Json has been discontinued in both YesSql and OrchardCore. Instead, we have transitioned to utilize System.Text.Json due to its enhanced performance capabilities. To ensure compatibility with System.Text.Json during the serialization or deserialization of objects, you have to undertake some steps.

For example, if your custom Document includes a collection with a getter-only property, it is imperative to incorporate a setter or utilize the init modifier to facilitate the assignment of values by System.Text.Json. For instance:

public class MediaProfilesDocument : Document
public Dictionary<string, MediaProfile> MediaProfiles { get; } = new(StringComparer.OrdinalIgnoreCase);

Should be changed to the following instead:

public class MediaProfilesDocument : Document
public Dictionary<string, MediaProfile> MediaProfiles { get; init; } = new(StringComparer.OrdinalIgnoreCase);

You also need to change how you register your custom deployment steps, custom AdminMenu nodes, and any serializable object that contains a polymorphic property (a base type that can contain sub-classes instances).

It will be a breaking change once the community releases the 1.9 version of Orchard Core. You can read more about what changes you should make under the release notes of the next release.

Drop Newtonsoft.Json Support documentation

News from the community

Municipal government permit management run on Orchard Core

Working in the GovTech space brings its own challenges - but not ones that can't be solved with Orchard Core! A customer of ours runs a permit management platform on Orchard Core too. We help them with consulting, Azure, and development. Head to our site and check out a GovTech company case study!

Lombiq GovTech company case study

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 476 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

No Comments

Add a Comment