On our second episode of Ask the Experts in 2021, I was joined by three of our Kentico Xperience MVPs (Most Valuable Professionals): Sean G. Wright, Trevor Fayas, and Mike Wills. This time we were going through several community posts, we discussed a few design patterns to be used when developing on Kentico Xperience and answered a few on-the-spot viewer questions.
If you missed us live, no worries because you can watch the replay of this episode below. If you’ve got questions of your own, throw them into the comments or reach out to us on DevNet or Slack!
Ask the Experts #2
Welcome to Ask the Experts! A show where we talk about and answer your questions around developing on, and for #KenticoXperience
Before we begin our recap, I must apologize to one of the guests, Mike Wills, for a faux pas I made when I classified him as being more on the business side than the technical side. While he has produced some great business content in the past few months, he has also provided many great technical solutions and contributions to the community.
Page builder troubleshooting
The first topic on the day’s agenda was discussing some troubleshooting tips for the Kentico Xperience built-in Page Builder. I personally could’ve used this recently because I ran in to one of the issues listed in the post while developing a set of Xperience 13 containers.
While trying to view the page builder within the Xperience administration portal, I was receiving a “preview URL has expired” error. The solution was not apparent based on the error message: I had forgotten to update the CMSHashStringSalt on the live site to match the one on the administration site.
To save yourself time in the future, make sure to bookmark this post and check it whenever you start receiving unexpected errors within the page builder.
Using docker with Kentico Xperience
Next, we looked at a recent post about how to use your ASP.NET Core live site in a docker container. Using containers with Xperience 13 allows new team members to get productive quicker. Developers can reproduce testable environments more easily and speed up site setup, configuration, and deployment because most of its configuration is already done within the container.
Look for more on this topic, as we’ll be releasing a set of container images for pre-configured and pre-loaded with Xperience 13.
Then we explored three design patterns our guests have recently blogged about. These patterns can greatly increase your code readability, testability, and scalability.
Good Startup.cs hygiene
As we start to expand the capability of our ASP.NET Core live site, the Startup.cs can quickly become unreadable. Sean identifies several key issues and how to reorganize the code.
Mike walks us through how we can use dependency injection within shared libraries and still use them in both the CMS application and the ASP.NET Core site without adding legacy code to work with the CMS application.
When using the MVC pattern, many developers think they have to follow the default file pattern implemented by the default template. As an application becomes larger, this file pattern can make it harder to identify the different code files that go together. Trevor explains and shows how feature folders can be used to move related code files closer together, keeping “your structure organized and neat.”
Questions from the Community
One of the main drivers for each episode of Ask the Experts is to answer questions from the community, whether asked in the forums or live during the show.
Does the life cycle in registered services IoC match between CMS and .NET Core App? Scoped or Transient?
Unfortunately, scoped doesn’t exist within the CMS container. Most of the time, though, use cases didn’t actually need scoped.
What are your recommendations on singleton vs transient registration of services?
Our MVPs gave a great answer on this and my paraphrasing wouldn’t do it justice. Click the link above to be taken to the exact timecode to hear the answers directly from the MVPs.
I like to have a bit more folder structure, can I have another level of folders to separate those specific features like "/Features/Admin/<all admin files> ?
Yes, to accomplish this, you would update the IViewLocationExpander to suit your use case.
E-commerce in Kentico Xperience
We wrapped up this episode talking about adding an e-commerce component to the Heartland Business Systems Kentico Xperience 13 Baseline project. Trevor and his team would like feedback from the community on what features and customization points you would like to see in an e-commerce baseline.
If you want to provide your input, head on over to the GitHub discussion and let them know what you think.
If you’ve solved a problem, got a problem that needs to be solved, or want to share your experience with Xperience, please reach out to me on Twitter, LinkedIn, or drop a message on the Ask the Experts discussion board and we’ll get you on the show.
Also, if you’ve got a topic you want to know more about, a problem you’re having trouble with, best practices for handling certain scenarios, or anything else, drop a message on the discussion board as well.
For the next episode of Ask the Experts, happening March 12, 2021, @ 9 am CST / 3 pm GMT on the Kentico Xperience YouTube channel, we’ll be joined by Chris Bass from Wakefly talking about some of his recent MVC work!
See you in the chat!