Option to disable SQLite connection pooling, tenant hostname duplicate check - This week in Orchard (08/04/2022)

Gábor Domonkos's avatar
Admin UI, Documentation, This week in Orchard

Adding an AppSetting option to disable SQLite connection pooling, improving tenant hostname duplicate check, Monaco loader aware of the virtual folder, and a new tutorial sample project in the Lombiq Vue.js module for Orchard Core! Check out our current post to read about the details!

Orchard Core updates

Added an AppSettings option to disable SQLite connection pooling

Most database configuration is handled automatically, but there are limited options that can affect the way the database works. By default in .NET 6, Microsoft.Data.Sqlite pools connections to the database. It achieves this by putting locking the database file and leaving connections open to be reused. If the lock is preventing tasks like backups, this functionality can be disabled. There may be a performance penalty associated with disabling connection pooling. See the Microsoft.Data.Sqlite documentation or the Orchard Core documentation for more details.

As you can see in the screen below, you can configure the UseConnectionPooling by using the appsettings.json to turn on the pooling that will be used by the SqliteConnectionStringBuilder when using SQLite.

Set up the SQLite connection pooling

Improving tenant hostname duplicate check

There was an issue about the tenant's hostname was not checked for existence if the other tenant has multiple hostnames. You could reproduce this bug by following these simple steps:

  1. Create a tenant with the hostnames "example1.com, example2.com".
  2. Create a tenant with the hostname "example1.com".
  3. Observe that you can create the second tenant even though the hostname is duplicated.

The expected behavior would be that you get the "A tenant with the same host and prefix already exists." validation error, and you can't save the tenant.

Note that the validation error is raised if the first tenant has just a single hostname specified. In the following example, we created a tenant with the name Tenant4. We keep everything as is, and we just provided the hostname to be example1.com. After we added another tenant by using Tenant5 as the name. We kept the prefix empty and used example1.com as the hostname again. As you can see, we got the following validation error.

Tenant hostname duplicate check validation error

Monaco loader is aware of the virtual folder

We use the tenant prefix to set a data-tenant-prefix attribute that will be used by the monaco loader.js to load editor.main.js. But it doesn't take into account a possible virtual folder, so here we use the PathBase instead. Jean-Thierry Kéchichian kept the data-tenant-prefix attribute name to not break anything.

Just for info, he tried to use tété as a tenant prefix, then in the HTML source code, we can see some attributes that are URL encoded t%C3%A9t%C3%A9, e.g., when .RouteUrl() is used, some are HTML encoded tété e.g., when @Url.Content(~/...) is used, and some that are not encoded tété, e.g., those provided by resources tag helpers.

We know that the browser is able to do the right decoding/encoding (escaping is more important, e.g., on server-side redirections), so he let things as is to not break anything. But here it is an HTML data attribute used by a script, so here he opted to use the escaped PathBase by not using .Value so that the implicit .ToString() will encode it if needed.

Don't forget that Url.Content("~/") doesn't encode URLs, so if you use href="@Url.Content("~/"), special chars that were not URL encoded will be HTML encoded by the rendering.

Monaco loader aware of virtual folder

News from the community

New tutorial sample project in the Lombiq Vue.js module for Orchard Core

The Lombiq Vue.js module for Orchard Core is an Orchard Core module that contains Vue.js and commonly used Vue.js components to be used in other Vue.js apps as dependencies. Provides extensibility to create Vue.js component templates as Orchard Core shapes making them able to override in themes or modules.

We wrote about having Single File Components in the module a few weeks ago, and from now, this module contains this new, polished, detailed tutorial sample project about integrating Vue.Js into Orchard Core. The sample project has different top-level training sections, like:

If you want to know more about it, don't forget to check out the mentioned This week in Orchard post and this recording on YouTube!

Readme of the Lombiq Vue.js module for Orchard Core samples

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 247 subscribers! 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 is 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!

If you are interested in more news around 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