public static bool IsMemberASerializableColumn(this RunTimeAttributeMap member) { if (member.ShouldMemberBeIgnored()) { return(false); } var attr1 = member.GetCustomAttribute <SqlColumnAttribute>(); if (attr1?.SerializableType == null) { return(false); } switch (attr1.SerializableType) { case SerializableType.None: return(false); case SerializableType.Xml: return(true); case SerializableType.Json: return(true); case SerializableType.Csv: return(true); default: throw new ArgumentOutOfRangeException(); } }
public static bool IsMemberAnIdentityColumn(this RunTimeAttributeMap member) { if (member.ShouldMemberBeIgnored()) { return(false); } var sqlColumnAttribute = member.GetCustomAttribute <SqlColumnAttribute>(); var dataAnnotationAttribute = member.GetCustomAttribute <DatabaseGeneratedAttribute>(); return ((dataAnnotationAttribute?.DatabaseGeneratedOption == DatabaseGeneratedOption.Identity || dataAnnotationAttribute?.DatabaseGeneratedOption == DatabaseGeneratedOption.Computed) || (sqlColumnAttribute?.IsIdentityKey == true) ); }