Using a custom attribute in EF7 (core) OnModelCreating
I have a DefaultAttribute defined like so: [AttributeUsage(AttributeTargets.Property)] public class DefaultAttribute : Attribute { /// <summary> /// Specifies this property has a default value upon creation. /// </summary> /// <param name="defaultValue">The default value of the property.</param> /// <param name="useAsLiteral">Set to true if the value is <em>not</em> quoted in the DDL.</param> public DefaultAttribute(object defaultValue, bool useAsLiteral = false) { DefaultValue = defaultValue; UseAsLiteral = useAsLiteral; } public object DefaultValue { get; private set; } /// <summary> ///