Skip to content

Instantly share code, notes, and snippets.

View ardalis's full-sized avatar
💭
Streaming weekly on twitch.tv/ardalis

Steve Smith ardalis

💭
Streaming weekly on twitch.tv/ardalis
View GitHub Profile
@ardalis
ardalis / gist:4a107ac7866ee34ba612e9d64850de51
Created December 9, 2020 04:32
DDD Patterns Lab setup
# https://github.com/ardalis/eshoponweb
# From a cmd prompt (not powershell) in C:\labfiles\eshoponweb\src\Web> run these commands one by one:
dotnet tool restore
SET ASPNETCORE_ENVIRONMENT=Production
dotnet ef database update -c catalogcontext -p ../Infrastructure/Infrastructure.csproj -s Web.csproj
@ardalis
ardalis / gist:77b73ae9c5baf8214bb3cf01546d539d
Created May 11, 2020 17:00
Mailchimp and Disqus Forms
<!-- Begin Mailchimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own Mailchimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="https://ardalis.us13.list-manage.com/subscribe/post?u=ddf5f72371bc4c837a6667f27&amp;id=40af84bfa3" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
@ardalis
ardalis / MoviesController.cs
Created August 28, 2014 17:19
Loosely Coupled Controller Index
using System;
using System.Data.Entity;
using System.Net;
using System.Web.Mvc;
using MvcMovie.Core.Interfaces;
using MvcMovie.Infrastructure.Data;
using MvcMovie.Infrastructure.Data.Repositories;
using MvcMovie.Models;
namespace MvcMovie.Controllers
@ardalis
ardalis / MoviesController.cs
Created August 28, 2014 17:09
Tightly Coupled Controller Index
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using MvcMovie.Models;
@ardalis
ardalis / StrategyPatternCSharp
Last active August 29, 2015 14:05
Strategy Pattern Example
public class MoviesController : Controller
{
private readonly IMovieRepository _movieRepository;
public MoviesController(IMovieRepository movieRepository)
{
_movieRepository = movieRepository;
}
public MoviesController() : this(new EfMovieRepository())
{}
@ardalis
ardalis / gist:4189306
Created December 2, 2012 15:22
MSTest Error
------ Run test started ------
Failed to configure settings for runsettings plugin 'VSTest Run Configuration' as it threw following exception:
'An error occurred while loading the settings. Error: Could not find 'RunSettings' node..'
Please contact the plugin author.
========== Run test finished: 2 run (0:00:06.830683) ==========
@ardalis
ardalis / gist:3752056
Created September 19, 2012 20:28
Explicit Dependencies
using System;
using System.IO;
using System.Linq;
namespace ExplicitDependencies
{
class Program
{
static void Main(string[] args)
{
@ardalis
ardalis / gist:3751934
Created September 19, 2012 20:09
Implicit Dependencies in C#
using System;
using System.IO;
using System.Linq;
namespace ImplicitDependencies
{
class Program
{
static void Main(string[] args)
{
@ardalis
ardalis / Program.cs
Last active September 20, 2021 09:00
A StructureMap Example using a Console Application
using System;
using System.Linq;
using StructureMap;
namespace ConsoleApplication1
{
/// <summary>
/// See http://stackoverflow.com/questions/6777671/setting-up-structure-map-in-a-c-sharp-console-application
/// Updated for SM 4: http://ardalis.com/using-structuremap-4-in-a-console-app
/// </summary>
@ardalis
ardalis / HomeController.cs
Created July 18, 2012 12:36
MVC4RC and StructureMap
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcApplication1.Controllers
{
public interface IHelloService
{