This week in Orchard - 09/20/2019

Performance, This week in Orchard

Now we are in the finish line of releasing the RC version of Orchard Core! Read our post for the most important things you should now about the new release and for a quick demo about the Cypress e2e testing suite for Orchard Core!

On Orchard Core

Some performance tweaks

Marko Lahma, the author of Quartz.NET made a lot of performance tweaks to make Orchard Core much faster. Let's see some of those!

In the RunningShellTable.cs use host.IndexOf(':') != -1 instead of host.Contains(':').

And a same performance tweak here:
instead of extensions.Contains(Path.GetExtensions(content.Name)) use Array.IndexOf(extensions, Path.GetExtension(content.Name)) != 1).

Also, do not use dynamic typing when it's not necessary. Instead of context.AmbientValues.TryGetValue("LiquidPage", out dynamic page)) use context.AmbientValues.TryGetValue("LiquidPage", out var page));.

He also created a project called OrchardCore.Benchmarks, where you can run some microbenchmark.

Migrate all Content Type / Part / Field Settings to Settings<T>

There were some places in the recipe where settings were not under the Settings property. Check the blog recipe for an example. Here you can see that everything is in its namespace. You can find a Settings property and inside that, there is a ContentTypeSettings property. By organizing all the settings in their correct path we get a cleaner recipe file.

Add default paging to GraphQL queries

We have three different new properties:

  • DefaultNumberOfResults: if you don't say first or last in your queries, we will limit the results to 100.
  • MaxNumberOfResults: if you define first of last (give me the last 2000 content items) we will block you and limit to 1000. If you didn't provide a first or last, and if you have so many results, it will slow down your system considerably. You should always page your queries, otherwise, you could load everything on the memory of the server and if you have multiple clients you will get out of memory or the performance will be slow.
  • MaxNumberOfResultsValiadtionMode: specify the validation behavior if the max number of results is exceeded in a pager parameter.
    * Default: in production info will be logged and only the max number of results will be returned. In development, a GraphQL validation error will be raised.
    * Enabled: a GraphQL validation error will be raised.
    * Disabled: info will be logged and only the max number of results will be returned.

Migration to .NET Core 3.0 RC

Now Orchard Core using .NET Core 3.0 RC, which means you need to install the new SDK (v3.0.100-rc1) to work with Orchard from here. Sebastien pinned the 1.0.0-beta3-72452 version on MyGet, so it won't be deleted, and it is the last one targeting .NET Core 2.2.

Don't forget: to work with Orchard Core, you will need Visual Studio 2019!

Orchard Core RC release

The plan is to ship Orchard Core RC next Monday, maybe on Tuesday, after .NET 3.0 is released, so we can update the dependencies and build the things. It will be on NuGet.org as well. This release will be followed with the 1.0 (RTM) version. The number of the new package will have the following convention: OrchardCore 1.0.0-rc1-10000. The build number will be reset to 10000 and will be increased by one with every build of the dev branch.

We need to update the documentation and the ASP.NET package references. There will be blog announcements: they could be in the Asp.net site right after the .NET Conf. Try Orchard Core will be updated to use the new version too.

Demos

Cypress e2e testing suite for Orchard Core

Cypress is a next-generation front end testing tool built for the modern web. Cypress is most often compared to Selenium; however, Cypress is both fundamentally and architecturally different. Cypress is not constrained by the same restrictions as Selenium. This enables you to write faster, easier and more reliable tests.

To use Cypress in Orchard Core first you have to run npm install in the test/cypress folder. Then followed by npm run test to build and host Orchard and run Cypress test on it.

This will execute the content of the test.js file. First builds the solution, starts the application and starts the different Cypress tests.

The test cases are in the integration folder, where now you can find three different cases:

  • Setup SaaS
  • Blog
  • Agency

Let's check the content of the Blog one. You can find a file called 01-setup-blog-tenant.js.

Here you can find different test methods, like cy.login(), or cy.gotoTenantSetup(blog). These functions are defined in the commands.js file within the support folder. Let's check quickly what are these methods for!

As you can see, using some predefined command, you can easily navigate to a given URL using visit. You can target the different HTML elements using get and submit a form easily as you can see in the screen above.

The Cypress testing suite for Orchard Core is in its early stage, but you can find the current state and follow the development in this branch.

On Lombiq

Orchard Dojo Newsletter

Now we have 90 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!

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 week's Orchard meeting!

No Comments

Add a Comment