Skip to content

Instantly share code, notes, and snippets.

View seangwright's full-sized avatar
🐻
Still learning...

Sean G. Wright seangwright

🐻
Still learning...
View GitHub Profile
@seangwright
seangwright / Address.cs
Last active April 15, 2024 21:55
Xperience by Kentico - Embedded structured content and the power of custom data types
namespace DancingGoat;
public class Address
{
public const string LIST_FIELD_TYPE = "addresslist";
public string Street { get; set; } = "";
public string City { get; set; } = "";
public string StateProvince { get; set; } = "";
public string PostalCode { get; set; } = "";
@seangwright
seangwright / settings.json
Last active February 10, 2024 00:01
VS Code workspace settings for a Kentico 12 MVC + Vue.js CLI project
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"node_modules": true,
"obj": true,
"bin": true,
@seangwright
seangwright / KebabRoutingConvention.cs
Created July 13, 2017 01:51
AspNet Core MVC attribute routing lower/kebab case controller placeholder replacement
/**
Takes something like this
[Route("api/customer/{customerId:int}/[controller]")]
public class SpecialOrderController : Controller
{
// ...
[HttpGet("~/api/[controller]")]
[Produces(typeof(IEnumerable<SpecialOrderResponse>))]
@seangwright
seangwright / _Layout.cshtml
Created July 5, 2021 19:46
Kentico Xperience 13 Dancing Goat Core
@using Microsoft.AspNetCore.Mvc.Localization
@using Kentico.Activities.Web.Mvc
@using Kentico.Membership.Web.Mvc
@using Kentico.OnlineMarketing.Web.Mvc
@using DancingGoat.Helpers
@using DancingGoat.Widgets
@inject IHtmlLocalizer<SharedResources> HtmlLocalizer
@seangwright
seangwright / Program.cs
Last active September 18, 2021 20:19
.NET 6 Console App w/ global usings
// See https://docs.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-usage
await Host
.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
services
.AddLogging()
.AddQuartz(quartz =>
{
quartz.SchedulerId = "Quartz-App";
quartz.SchedulerName = "Quartz-App";
@seangwright
seangwright / DefaultPageTemplateFilter.cs
Created March 14, 2021 23:54
Kentico Xperience Page Template Filter base class
/// <summary>
/// Default filter for associating Page Types to Page Templates
/// </summary>
public abstract class DefaultPageTemplateFilter : IPageTemplateFilter
{
/// <summary>
/// If true, then the templates returned by <see cref="FilterBy(PageTemplateDefinition)"/> are excluded from the results of <see cref="Filter(IEnumerable{PageTemplateDefinition}, PageTemplateFilterContext)"/>
/// when the <see cref="PageTypeClassName"/> does not match the Page Type of the context.
/// Defaults to false.
/// </summary>
@seangwright
seangwright / EmailMacroMethodContainer.cs
Created January 21, 2021 18:52
Reusable Xperience Email Transformations
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
seangwright / web.config
Created January 19, 2021 05:45
Sample web.config from Kentico Xperience 13.0 Content Management application
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- Content staging BEGIN -->
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<!-- Content staging END -->
<!-- AjaxControlToolkit BEGIN -->
<section name="ajaxControlToolkit" type="AjaxControlToolkit.AjaxControlToolkitConfigSection, AjaxControlToolkit" requirePermission="false" />
<!-- AjaxControlToolkit END -->
</configSections>
@seangwright
seangwright / QueryableBuilder.cs
Created April 24, 2019 03:01
QueryableBuilder / Transformer pattern for easy query re-use behind a CQRS abstraction layer
/// Interfaces
public interface IQueryableBuilder<TReturn>
{
/*
We require the context to be provided via method to
make it obvious this type works with persistence
If this was provided through DI then it wouldn't be as obvious
if this type were accidentally used in a layer beyond the persistence layer
*/
IQueryable<TReturn> Build(IDbContext context);
@seangwright
seangwright / README.md
Created May 6, 2020 04:17
README sample for Kentico projects

project-code-name

Kentico 12 MVC application for <...>

Current Kentico

12.0.68

.NET Framework