Skip to content

Instantly share code, notes, and snippets.

Still learning...

Sean G. Wright seangwright

Still learning...
View GitHub Profile
seangwright / EmailMacroMethodContainer.cs
Created Jan 21, 2021
Reusable Xperience Email Transformations
View EmailMacroMethodContainer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using CMS;
using CMS.Helpers;
using CMS.MacroEngine;
using CMS.PortalEngine;
using CMS.SiteProvider;
using Sandbox.Infrastructure.Emails;
seangwright / web.config
Created Jan 19, 2021
Sample web.config from Kentico Xperience 13.0 Content Management application
View web.config
<?xml version="1.0" encoding="utf-8"?>
<!-- Content staging BEGIN -->
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<!-- Content staging END -->
<!-- AjaxControlToolkit BEGIN -->
<section name="ajaxControlToolkit" type="AjaxControlToolkit.AjaxControlToolkitConfigSection, AjaxControlToolkit" requirePermission="false" />
<!-- AjaxControlToolkit END -->
seangwright /
Created May 6, 2020
README sample for Kentico projects


Kentico 12 MVC application for <...>

Current Kentico


.NET Framework

seangwright / settings.json
Last active Oct 21, 2019
VS Code workspace settings for a Kentico 12 MVC + Vue.js CLI project
View settings.json
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"node_modules": true,
"obj": true,
"bin": true,
View PageTypeRouteAttributeCacheHelperCacheHelper.cs
public static class PageTypeRouteAttributeCacheHelper
public static readonly Dictionary<string, ControllerActionPair> ClassNameLookup;
static PageTypeRouteAttributeCacheHelper()
var controllerTypes = typeof(PageTypeRouteAttributeCacheHelper)
.Where(t =>
seangwright / JsonDotNetValueProviderFactory.cs
Created Jun 26, 2019
Custom Json Serialization for ASP.NET MVC
View JsonDotNetValueProviderFactory.cs
/// <summary>
/// From
/// </summary>
public class JsonDotNetValueProviderFactory : ValueProviderFactory
private readonly JsonSerializerSettings serializerSettings;
public JsonDotNetValueProviderFactory(JsonSerializerSettings serializerSettings)
Guard.Against.Null(serializerSettings, nameof(serializerSettings));
seangwright / ApiExceptionResult.cs
Last active Jun 26, 2019
Error Handling in Web Api 2
View ApiExceptionResult.cs
public class ApiExceptionResult : IHttpActionResult
private static readonly MediaTypeHeaderValue mediaType = new MediaTypeHeaderValue("application/json");
private readonly ApiError errorResponse;
private readonly JsonMediaTypeFormatter jsonMediaTypeFormatter;
private readonly HttpRequestMessage requestMessage;
private readonly HttpStatusCode statusCode;
public ApiExceptionResult(HttpRequestMessage requestMessage, HttpStatusCode statusCode, ApiError errorResponse, JsonMediaTypeFormatter jsonMediaTypeFormatter)
seangwright / KenticoMvcApp.csproj
Last active Jun 26, 2019
WebApi2 Swashbuckle integration
View KenticoMvcApp.csproj
<!-- Add this to ensure the XML comments are picked up by the Swashbuckle integration -->
View UserInfoTests.cs
public class UserInfoTests : UnitTests
public void IsAuthorized_Will_Return_True_When_User_Is_In_All_Roles(
int userId,
string userName,
int siteId,
string siteName,
int roleId1,
seangwright / DependencyResolverConfig.cs
Last active Jul 10, 2019
Kentico 12: Design Patterns Part 4 - Adding Dependency Injection to the CMS
View DependencyResolverConfig.cs
public static class DependencyResolverConfig
public static IContainer BuildContainer()
var builder = new ContainerBuilder();
// My registration classes use a "fluent" interface, always returning the ContainerBuilder
// so the next call can be chained off the previous
var container = builder