Database and Azure blob shells configuration, Orchard Core workshops - This week in Orchard (10/04/2020)

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

Database and Azure blob shells configuration are added to Orchard Core! To get up to speed with Orchard Core the contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. Check out the workshops' details on the Orchard Core homepage!

Orchard Core updates

Account views validation messages

Instead of using DataAnnotations, in some ViewModels, we are using custom validation methods by implementing the IValidatableObject interface. The reason for that is the DataAnnotations are not localized correctly yet, but this is just a mitigation of the issue and this will be soon supported in Orchard Core. So, let's see an example of that from the OrchardCore.Users module.

Here you could see that the Validate method in RegisterViewModel is about to check the values of the required fields and make sure that the user provided the same password in both cases. If there is a validation error, the method returns different kinds of ValidationResults, that contains the localized error message and the list of member names that have validation errors.

Database and Azure blob shells configuration

The Azure Shells Configuration and Database Shells Configuration providers allow hosting of shell/tenant tenants.json files and related tenants appsettings.json configuration settings in an environment external to the Orchard Core host.

By default, the tenants.json and related appsettings.json for the Default shell and any configured tenants are stored in the App_Data folder.

This configuration in the App_Data folder is suitable for most sites, however for advanced configuration of stateless multi-tenancy environments, where multiple hosts require write access to these shared configuration settings, you can choose to use either the Azure Shells Configuration or Database Shells Configuration providers.

The primary purpose of the Shell Configuration providers is to provide a shared external environment for multi-tenancy where tenants need to be created, and their settings mutated, during live operation of the stateless hosts.

It is not intended to support shared configuration between local development and production environments.

Here you can see great documentation about how to set up the Azure Shells Configuration Provider and the Database Shell Configuration Provider!

Remove unneeded files in TheAdmin

There were unneeded files in the TheAdmin theme: the TheAdmin.css and the TheAdmin.min.css. The goal is to have an admin theme that could be used in mobile devices and provide a great user experience. Deleting unneeded files is another step toward mobile-friendliness.

Blog theme: Article with MediaField

Setup your site using the Blog recipe and head to the admin UI of Orchard Core. This recipe comes with an Article content type. If you create a new Article or edit the predefined one, you will see a new MediaField with the Banner Image display name. Let's change the Banner Image of the existing one and see what will happen!

As you can see, this change is to allow users to specify a background picture for an Article.

Update ShellHost registrations

Currently, we have the following DI registrations for the ShellHost:

services.AddSingleton<ShellHost>();
services.AddSingleton<IShellHost>(sp => sp.GetRequiredService<ShellHost>());
services.AddSingleton<IShellDescriptorManagerEventHandler>(sp => sp.GetRequiredService<ShellHost>());

So here if someone overrides IShellHost, when we resolve <IShellDescriptorManagerEventHandler> as an IEnumerable the ShellHost implementation is still used. The solution is to modify the IShellHost interface in the following way:

public interface IShellHost: IShellDescriptorManagerEventHandler {}

And now the registrations will look slightly different:

services.AddSingleton<IShellHost, ShellHost>();
services.AddSingleton<IShellDescriptorManagerEventHandler>(sp => sp.GetRequiredService<IShellHost>());

Now it forces the one that overrides IShellHost to also implements <IShellDescriptorManagerEventHandler> and when all <IShellDescriptorManagerEventHandler> are resolved as an IEnumerable, the right instance is used.

Documentation for missing content fields

The first table of the Content Fields page in the Orchard Core documentation is about to show you the available fields and their properties. The MarkdownField, MediaField and TaxonomyField were missing from this list.

Apply Bootstrap styles to message based on the notification type

You can use the INofitier to manage UI notifications. You can have different types of notifications and the notifications with different types can be displayed differently. Orchard Core uses Bootstrap alerts to display the notifications. To add a custom display for every type of notification the Message.cshtml file is now using the contextual classes from Bootstrap (like .alert-success).

Setup screen improvements

The setup screen has got several improvements:

  • Removed Bootstrap Jumbotron.
  • Moved function setLocalizationUrl() to setup.js.
  • Moved the code and HTML about the culture list from _Layout.cshtml to Index.cshtml.
  • Used fieldset instead of h6 when displaying the Super User text.
  • Separated hints between database and table prefix.

News from the community

Orchard Core workshops

The contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events.

Lombiq's developers will also give two workshops, on using Orchard from the admin UI and on developing a module.

Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage!

Here you could see a table that contains more information about the first 5 workshops.

The Resources page of the Orchard Core documentation has updated with the details of the workshops too where you can also find the Sign-up sheet.

Orchard Dojo Newsletter

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

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

No Comments

Add a Comment