Skip to content

Instantly share code, notes, and snippets.

@tystol
tystol / PostalEmailService.cs
Last active June 30, 2020 08:34
Postal Emails with layouts outside a http request context. There's a few application specific interfaces in here, but should be fairly easy to strip out and adapt.
public class PostalEmail<T> : Email where T : IEmail
{
public PostalEmail(string viewName, T model)
: base(viewName)
{
To = model.To;
Email = model;
}
public string To { get; private set; }
@tystol
tystol / CascadeDeleteAttribute.cs
Last active October 26, 2022 21:55
Entity Framework CascadeDelete using Data Annotations
using System;
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class CascadeDeleteAttribute : Attribute { }