This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Aggregate has a reference to its root entity. | |
public class WebAppAggregate : Aggregate | |
{ | |
public Guid Id; // Aggregate Id. | |
public WebAppEntity WebApp; | |
public WebAppAggregate(Guid id, WebAppEntity webApp); | |
public Result SomeInvariant(...); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* File structure: | |
* /Domain/WebMonitoring/WebAppAggregate/WebApp.cs | |
* /Domain/WebMonitoring/WebAppAggregate/WebAppService.cs | |
* /Domain/WebMonitoring/WebAppAggregate/IWebAppRepository.cs | |
* /Domain/WebMonitoring/WebAppAggregate/IHttpStatusChecker.cs | |
* | |
* This way, the Aggregate itself is not "materialized" as a class or any programming resource. | |
* It is a concept, and its invariants are enforced by the WebApp (entity, aggregate root) and | |
* WebAppService. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Net.Mail; | |
using System.Text.RegularExpressions; | |
namespace Domain.Core | |
{ | |
public interface IGuardClause { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
Double Click Scroller | |
license: MIT | |
https://gist.github.com/phillippelevidad/7e5723ec2a69347b1dd65a378f66de8b | |
JavaScript funcionality similar to Basecamp's: double click the first third of the viewport to smoothly scroll to the top, | |
and the bottom third to scroll to the bottom. Quick up and down page navigation! | |
JQuery is required. | |
Just call dblclickScroller.init() and you're done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate a self-signed certificate | |
# Browse to Control Panel > Manage computer certificates > Personal > Certificates and find yours | |
$dnsName = "www.example.com" | |
$friendlyName = "Example" | |
New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName $dnsName -FriendlyName $friendlyName -NotAfter (Get-Date).AddYears(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace UserVoiceFun.Domain | |
{ | |
public abstract class Entity | |
{ | |
public Guid Id { get; protected set; } = Guid.NewGuid(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* EF Core implementation of SoftDeletes. | |
* | |
* Just specify entity types that should not be hard deleted in the SoftDeleteMapper class | |
* and this code will handle the rest, by: | |
* 1. Adding the IsDeleted and DeletedAt columns; | |
* 2. Applying a query filter to prevent soft-deleted entries from being returned on reads; | |
* 3. Automatically rewriting deletes so that they only set entries as deleted, preventing hard-deletes. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://stackoverflow.com/a/28344281/484108 | |
// and https://jaketrent.com/post/addremove-classes-raw-javascript/ | |
function hasClass(el, className) { | |
return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)')); | |
} | |
function addClass(el, className) { | |
if (!hasClass(el, className)) el.className += ' ' + className; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.TestHost; | |
using System; | |
using System.Net.Http; | |
namespace Tests | |
{ | |
public class InjectionFixture : IDisposable | |
{ | |
private readonly TestServer server; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer : Entity | |
{ | |
public Guid Id { get; set; } | |
public string Name { get; set; } | |
public bool IsAdvanced { get; set; } | |
} |
OlderNewer