public static bool IsPropertyPrimaryKey(PropertyInfo propertyInfo) { var value = propertyInfo?.GetFirstCustomAttribute<PrimaryKeyAttribute>(true); return value != null && value.IsPrimaryKey; }