-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b55da2
commit 8fcd68b
Showing
7 changed files
with
89 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 10 additions & 11 deletions
21
src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlForeignKeyExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
|
||
// ReSharper disable once CheckNamespace | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.Internal; | ||
// ReSharper disable once CheckNamespace | ||
|
||
namespace Microsoft.EntityFrameworkCore; | ||
|
||
/// <summary> | ||
/// Npgsql specific extension methods for <see cref="IForeignKey"/>. | ||
/// Npgsql specific extension methods for <see cref="IForeignKey" />. | ||
/// </summary> | ||
public static class NpgsqlForeignKeyExtensions | ||
{ | ||
/// <summary> | ||
/// Sets the <see cref="PostgresMatchStrategy"/> for a foreign key. | ||
/// Sets the <see cref="PostgresMatchStrategy" /> for a foreign key. | ||
/// </summary> | ||
/// <param name="foreignKey">the foreign key being configured.</param> | ||
/// <param name="matchStrategy">the <see cref="PostgresMatchStrategy"/> defining the used matching strategy.</param> | ||
/// <param name="matchStrategy">the <see cref="PostgresMatchStrategy" /> defining the used matching strategy.</param> | ||
/// <remarks> | ||
/// <see href="https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES"/> | ||
/// <see href="https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES" /> | ||
/// </remarks> | ||
public static void SetMatchStrategy(this IMutableForeignKey foreignKey, PostgresMatchStrategy matchStrategy) | ||
=> foreignKey.SetOrRemoveAnnotation(NpgsqlAnnotationNames.MatchStrategy, matchStrategy); | ||
|
||
/// <summary> | ||
/// Returns the assigned <see cref="PostgresMatchStrategy"/> for the provided foreign key | ||
/// Returns the assigned <see cref="PostgresMatchStrategy" /> for the provided foreign key | ||
/// </summary> | ||
/// <param name="foreignKey">the foreign key</param> | ||
/// <returns>the <see cref="PostgresMatchStrategy"/> if assigned, null otherwise</returns> | ||
public static PostgresMatchStrategy? GetMatchStrategy(this IReadOnlyForeignKey foreignKey) => | ||
(PostgresMatchStrategy?)foreignKey[NpgsqlAnnotationNames.MatchStrategy]; | ||
} | ||
/// <returns>the <see cref="PostgresMatchStrategy" /> if assigned, null otherwise</returns> | ||
public static PostgresMatchStrategy? GetMatchStrategy(this IReadOnlyForeignKey foreignKey) | ||
=> (PostgresMatchStrategy?)foreignKey[NpgsqlAnnotationNames.MatchStrategy]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters