Verifying Mock Parameters
Andy Butland
by
2w ago
Found a use case for a feature of the .NET mocking framework Moq that may not be that well known, and was new to me at least. I had a method under test that - via a number of overloaded extension methods - called an underlying method in the Umbraco CMS. The details aren't really important, but specifically it was the method GetImageUrl on IImageUrlGenerator that I was mocking to return a known output. I was then testing how my method used that result it in it's processing. I could see the method failing when I had a setup like this: But passed with this: So clearly we weren't passing in the He ..read more
Visit website
Upgrading Terraform Resources
Andy Butland
by
3w ago
One of the projects I currently work on consists of a few components - an API, a worker process, a couple of web applications and a serverless functions app - all of which are deployed to Azure using infrastrure as code defined as Terraform resources. We have recently been upgrading it from .NET 6 to .NET 8 and hit an issue when we tried to update the framework definition of the Azure app service resources defined in Terraform. The attribute in question only accepted up to .NET 6. The reason is that the resource we were using - azurerm_app_service - is now deprecated and replaced with azurerm_ ..read more
Visit website
Adding and Deleting Criteria
Andy Butland
by
6M ago
This is one of a series of posts looking at migrating Umbraco packages to Umbraco 14 and the new backoffice. Other posts in this series: Introduction Upgrading to Umbraco 14 Preview Creating a Property Editor With Umbraco 14 Adding and Deleting Criteria As of last time I posted in this series, I had a partially working property editor for Personalisation Groups. It could display the information stored against the property, and I'd solved a couple of challenges around retrieving external data and injecting scripts dynaically at runtime. There's not been too much progress since, but I've pick ..read more
Visit website
First Steps with Umbraco 14
Andy Butland
by
7M ago
Probably the largest change coming in the Umbraco ecosystem is the development of a new backoffice, removing the dependency on the legacy angularjs and moving to a modern front-end stack based on web components and Typescript. Not just for HQ in the work needed to update the CMS itself and associated commercial products. But also for the community, whether that be package developers or custom solution implementors looking to extend the backoffice. It reminds me a little of the time coming up to Umbraco 9, the first version running on modern .NET. There was a lot of collbarative effort and info ..read more
Visit website
Upgrading to Umbraco 14 Preview
Andy Butland
by
7M ago
This is one of a series of posts looking at migrating Umbraco packages to Umbraco 14 and the new backoffice. Other posts in this series: Introduction Upgrading to Umbraco 14 Preview Creating a Property Editor With Umbraco 14 Prerequisites As indicated in the official documentation, to work with Umbraco 14 it's likely your development machine needs some updates, which was the case for me. You'll need: To be running .NET 8, which is available at the time of writing in a first release candidate. To be on at least the v17.8 latest preview version of Visual Studio. To download and install this y ..read more
Visit website
Creating a Property Editor With Umbraco 14
Andy Butland
by
7M ago
This is one of a series of posts looking at migrating Umbraco packages to Umbraco 14 and the new backoffice. Other posts in this series: Introduction Upgrading to Umbraco 14 Preview Creating a Property Editor With Umbraco 14 A "Hello World" Property Editor The Umbraco documentation is a good guide for getting started, with details on creating an extension and creating a property editor. Using the scripts provided I created an extension within a folder created in my main package project that I called client-src. npm create vite@latest -- --template lit-ts personalisation-groups cd personalis ..read more
Visit website
Migrating An API from Newtonsoft.Json to System.Text.Json
Andy Butland
by
9M ago
In some recent work with Umbraco I’ve been looking to migrate an API from using the Newtonsoft.Json serialization library to the newer, Microsoft one, System.Text.Json. The reason for doing this was to align the API we created for Umbraco Forms with the content delivery API available in Umbraco 12. We’re keen to ensure these APIs across Umbraco products are similar both in terms of behaviour but also behind the scenes when it comes to the libraries we are using. As such I had a few updates to make – mostly straightforward, and some that needed a bit more research and development. Deserializati ..read more
Visit website
Introducing Redis and Azure Cognitive Search to Improve API Performance
Andy Butland
by
11M ago
Cross-posting a couple of articles written for the Umbraco blog on the introduction of Redis Distributed Cache and Azure Cognitive Search to the Umbraco Marketplace, in order to improve performance and functionality: Introducing Redis Distributed Cache to the Umbraco Marketplace Populating and Querying Azure Cognitive Search in the Umbraco Marketplace ..read more
Visit website
Programmatically Creating a Record With Umbraco Forms
Andy Butland
by
1y ago
Umbraco Forms is a commercial add-on for Umbraco providing an editor interface for creating and managing forms. These forms can then be hosted on the website for completion by site visitors, with the entries available for view in the Umbraco backoffice. That describes the usual use-case, but it is also possible to create form submissions - known as records - for a form programatically. Posting for future reference, this illustrative example for Forms 10 shows how this is done ..read more
Visit website
Use PostConfigure For Default Configuration of Collections in ASP.NET
Andy Butland
by
1y ago
This post contains a couple of topcis that came together in a recent update I was making - one a gotcha, and one a solution, that as well as addressing this issue has wider application. In my web application there was some configuration that consisted of a list of elements. This was represented in code with a POCO like this: Which can then be injected using IOptions<MySettings> into the classes that need it. And in configuration, via the appSettings.json file, you can provide the values: So far so good, but now I wanted to set some default values for this configuration. If nothing is pro ..read more
Visit website

Follow Andy Butland on FeedSpot

Continue with Google
Continue with Apple
OR