/// <summary> /// Returns the foreign key constraint name. /// </summary> /// <param name="foreignKey"> The foreign key. </param> /// <returns> The foreign key constraint name. </returns> public static string GetConstraintName([NotNull] this IForeignKey foreignKey) { var annotation = foreignKey.FindAnnotation(RelationalAnnotationNames.Name); return(annotation != null ? (string)annotation.Value : foreignKey.GetDefaultName()); }
/// <summary> /// Returns the foreign key constraint name. /// </summary> /// <param name="foreignKey"> The foreign key. </param> /// <param name="storeObject"> The identifier of the containing store object. </param> /// <param name="principalStoreObject"> The identifier of the principal store object. </param> /// <returns> The foreign key constraint name. </returns> public static string GetConstraintName( [NotNull] this IForeignKey foreignKey, StoreObjectIdentifier storeObject, StoreObjectIdentifier principalStoreObject) { var annotation = foreignKey.FindAnnotation(RelationalAnnotationNames.Name); return(annotation != null ? (string)annotation.Value : foreignKey.GetDefaultName(storeObject, principalStoreObject)); }
/// <summary> /// Returns the foreign key constraint name. /// </summary> /// <param name="foreignKey"> The foreign key. </param> /// <param name="tableName"> The table name. </param> /// <param name="schema"> The schema. </param> /// <param name="principalTableName"> The principal table name. </param> /// <param name="principalSchema"> The principal schema. </param> /// <returns> The foreign key constraint name. </returns> public static string GetConstraintName( [NotNull] this IForeignKey foreignKey, [NotNull] string tableName, [CanBeNull] string schema, [NotNull] string principalTableName, [CanBeNull] string principalSchema) { var annotation = foreignKey.FindAnnotation(RelationalAnnotationNames.Name); return(annotation != null ? (string)annotation.Value : foreignKey.GetDefaultName(tableName, schema, principalTableName, principalSchema)); }