Once In A White Moon - by Gina Therese Hvidsten
© 2019
Once In A White Moon

MVC Attribute Routing in Sitecore 9

Due to Sitecore’s peculiarities, it doesn’t support Attribute Routing out of the box, and using the MapMvcAttributeRoutes()  extension method in MVC is not recommended. Sitecore does support MVC Routing, though, and Sitecore’s documentation on MVC routing gave me something to work with to allow me to use Attribute Routing. As the documentation states, you need to inject a custom pipeline after  Sitecore.Pipelines.Loader.EnsureAnonymousUsers. This placement ensures that we can still track logged in users in our attribute routes. Instead of adding each route manually as in the documentation, I use reflection to get all controllers from my assemblies, loop through all the methods in each controller, and check for the existence of MVC Route attributes. If the method has a route attribute I then create a new route using […] Read more

Sitecore Marketing Automation Custom Predicate woes

TL;DR: If you are getting “No predicate descriptor was registered with Id ‘9f3a44f4-179a-4d19-8583-14a8874e5bba’” in your Automation Engine log, make sure your XML definition file is prefixed with “sc.”   I recently needed to create some custom predicates for Marketing Automation in Sitecore 9.0. Sitecore has made a decent attempt at documenting what you need to do, but it is quite lacking in one specific area. After you have created your new class and inherited from ICondition (don’t worry about IContactSearchQueryFactory. It is not specifically mentioned, but for Marketing Automation rules you only need ICondition) you need to copy the DLL file that contains your custom predicate to the Automation Engine in this location: XConnectFolder\App_data\jobs\continuous\AutomationEngine. You also need to create an XML file for Automation Engine […] Read more

WPF, EntityFrameworkCore and SQLite

After starting on a new programming project I needed some way to have the application persist data between sessions. I eventually found SQLite, and the enthusiasm grew as I found out that there is an EntityFramework provider for this. Microsoft has even went a step further and made an EntityFrameworkCore implementation, which even supports migrations (albeit limited). When I saw that EntityFrameworkCore was supported even in regular .NET applications I reached peak enthusiasm and decided that this was my path. I eagerly started reading Microsoft’s “Getting started” documents, and almost immediately ran into problems. The migrations described in the previous link all mention running “dotnet ef” commands. The problem is that the documentation doesn’t specify where to execute those commands. And when I finally found out that […] Read more

I managed to finish a new project!

As some of you know I’m very good at starting new projects… not so good at finishing them. This time, however, I’ve actually done it! I came up with a new project, started doing it, and have now actually finished it! At the office we have some hardware with a serial port and we needed to see what kind data was sent from the hardware. Initially I thought that that would be easy as there should be many simple tools for this on the internet. I was wrong. We downloaded a lot of different tools, but none worked. After a while we finally found one that worked, but that only had a trial version (which sufficed for our quick debugging). Seeing as this kind of software […] Read more