private static ForeignKeyAttribute GetForeignKeyAttribute(TypeBase entityType, string propertyName) => entityType.GetRuntimeProperties()?.Values .FirstOrDefault( p => string.Equals(p.GetSimpleMemberName(), propertyName, StringComparison.OrdinalIgnoreCase) && Attribute.IsDefined(p, typeof(ForeignKeyAttribute), inherit: true)) ?.GetCustomAttribute <ForeignKeyAttribute>(inherit: true);