Leverage CSPROJ meta information, Lombiq Helpful Libraries - Navigation for Orchard Core - This week in Orchard (29/04/2022)
Adding an AppSetting option to disable SQLite connection pooling, leveraging your CSPROJ meta information and news and updates around the Lombiq Helpful Libraries! Check out our current post to read about the details!
Orchard Core updates
Remove Lucene from built-in recipes
This is about making the built-in setup recipes lightweight: Lucene is a feature that you don't need on every site, especially due to it storing files on the local file system that need to be preserved (i.e., not temp files) it needs special considerations for hosting (you need to take care of those files when moving the app between environments and doing deployments).
The goal here is to not enable Lucene by default in the following recipes:
- Headless: just remove it.
- Blank: just remove it.
- Create an SQL RecentBlogPosts Query and don't enable Lucene by default.
- Have a separate, non-setup recipe to set up the search just for a frontend search page (i.e., 90% of what happens related to Lucene in the recipe now).
- Have a second non-setup recipe that runs the previous one and also swaps out RecentBlogPosts with a Lucene Query.
And from now you can find two new optional recipes in the TheBlogTheme:
- Lucene Query Recipe: this recipe runs the Blog Lucene Search recipe and as an example, the recipe replaces the RecentBlogPosts SQL query with a Lucene query.
- Lucene Search Recipe: this recipe enables the Lucene feature and creates the Search setting, Lucene indices, and permissions.
The Recipes and Starter Themes page of the Orchard Core documentation has also been updated to reflect these changes.
Leverage CSPROJ meta information
Out of the box, a Manifest.cs file is generated, which includes the ModuleAttribute, FeatureAttribute, ThemeAttribute, and so forth, that describe the Orchard Core meta-information about your projects. However, let's say you want to connect available meta properties at the CSPROJ level, i.e., such properties as $(MSBuildProjectName), $(AssemblyVersion), $(PackageTags), to name a few.
At its core, you may want to follow a pattern similar to InternalsVisibleTo, i.e.
The principles are the same, but in prior versions, the attribute constructors were not available to lean into. Michael W Powell also decided to provide helpful MSBuild Items as a more accessible, self-documenting shorthand input.
From now, you can connect available meta properties at the CSPROJ level by leveraging CSPROJ meta information. If you are interested in how to leverage Orchard Core CSPROJ item lists and properties to enrich and get the absolute most from your authoring experience, this is the page you should take a look at!
News from the community
Lombiq Helpful Libraries - Navigation for Orchard Core
The Lombiq Helpful Libraries contains various useful libraries that can be handy when developing for .NET, ASP.NET Core, and Orchard Core, to be used for your own projects. This time we would like to show you two helpful abstract classes: the NavigationProviderBase and the MainMenuNavigationProviderBase.
- NavigationProviderBase: an abstract base class for creating reducing boilerplate in INavigationProvider for checking the name parameter and if the user is authenticated.
- MainMenuNavigationProviderBase: an abstract base class derived from NavigationProviderBase for creating a home page menu structure using the main navigation name. If you use the Lombiq.BaseTheme automatically displays the generated menu as a widget in the Navigation zone.
There is a Lombiq.HelpfulLibraries.Samples project for various examples in the form of an Orchard Core module. And that project contains a class called HelpfulLibrariesNavigationProvider.
This class inherits the MainMenuNavigationProviderBase, which overrides the NavigationName with the "main" value. And if you check out the sample code here, you can see some other interesting stuff, like how we set up where to navigate users when they click on the given menu items.
.ActionTask<LinqToDbSamplesController>(context, controller => controller.SimpleQuery()))
In this case, we say that let's navigate the user to the SimpleQuery action of the LinqToDbSamplesController. And of course, you have the option to provide additional arguments as well if you check out the NavigationItemBuilderExtensions static class.
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!