diff --git a/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs b/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs
index 29b621ed9..a46a10df1 100644
--- a/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs
+++ b/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs
@@ -80,9 +80,9 @@ public override MethodCallCodeFragment GenerateFluentApi(IModel model, IAnnotati
var enumTypeDef = new PostgresEnum(model, annotation.Name);
return enumTypeDef.Schema == "public"
- ? new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasEnum),
+ ? new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresEnum),
enumTypeDef.Name, enumTypeDef.Labels)
- : new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasEnum),
+ : new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresEnum),
enumTypeDef.Schema, enumTypeDef.Name, enumTypeDef.Labels);
}
@@ -95,13 +95,13 @@ public override MethodCallCodeFragment GenerateFluentApi(IModel model, IAnnotati
rangeTypeDef.Collation == null &&
rangeTypeDef.SubtypeDiff == null)
{
- return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasRange),
+ return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresRange),
rangeTypeDef.Schema == "public" ? null : rangeTypeDef.Schema,
rangeTypeDef.Name,
rangeTypeDef.Subtype);
}
- return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.ForNpgsqlHasRange),
+ return new MethodCallCodeFragment(nameof(NpgsqlModelBuilderExtensions.HasPostgresRange),
rangeTypeDef.Schema == "public" ? null : rangeTypeDef.Schema,
rangeTypeDef.Name,
rangeTypeDef.Subtype,
@@ -123,7 +123,7 @@ public override MethodCallCodeFragment GenerateFluentApi(IEntityType entityType,
return new MethodCallCodeFragment(nameof(NpgsqlEntityTypeBuilderExtensions.ForNpgsqlHasComment), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.UnloggedTable)
- return new MethodCallCodeFragment(nameof(NpgsqlEntityTypeBuilderExtensions.ForNpgsqlIsUnlogged), annotation.Value);
+ return new MethodCallCodeFragment(nameof(NpgsqlEntityTypeBuilderExtensions.IsUnlogged), annotation.Value);
return null;
}
@@ -139,11 +139,11 @@ public override MethodCallCodeFragment GenerateFluentApi(IProperty property, IAn
switch ((NpgsqlValueGenerationStrategy)annotation.Value)
{
case NpgsqlValueGenerationStrategy.SerialColumn:
- return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.ForNpgsqlUseSerialColumn));
+ return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.UseSerialColumn));
case NpgsqlValueGenerationStrategy.IdentityAlwaysColumn:
- return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.ForNpgsqlUseIdentityAlwaysColumn));
+ return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn));
case NpgsqlValueGenerationStrategy.IdentityByDefaultColumn:
- return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.ForNpgsqlUseIdentityByDefaultColumn));
+ return new MethodCallCodeFragment(nameof(NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn));
case NpgsqlValueGenerationStrategy.SequenceHiLo:
throw new Exception($"Unexpected {NpgsqlValueGenerationStrategy.SequenceHiLo} value generation strategy when scaffolding");
default:
@@ -160,17 +160,17 @@ public override MethodCallCodeFragment GenerateFluentApi(IProperty property, IAn
public override MethodCallCodeFragment GenerateFluentApi(IIndex index, IAnnotation annotation)
{
if (annotation.Name == NpgsqlAnnotationNames.IndexMethod)
- return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasMethod), annotation.Value);
+ return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasMethod), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexOperators)
- return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasOperators), annotation.Value);
+ return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasOperators), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexCollation)
- return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasCollation), annotation.Value);
+ return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasCollation), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexSortOrder)
- return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasSortOrder), annotation.Value);
+ return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasSortOrder), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexNullSortOrder)
- return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlHasNullSortOrder), annotation.Value);
+ return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.HasNullSortOrder), annotation.Value);
if (annotation.Name == NpgsqlAnnotationNames.IndexInclude)
- return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.ForNpgsqlInclude), annotation.Value);
+ return new MethodCallCodeFragment(nameof(NpgsqlIndexBuilderExtensions.IncludeProperties), annotation.Value);
return null;
}
diff --git a/src/EFCore.PG/Extensions/NpgsqlEntityTypeBuilderExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlEntityTypeBuilderExtensions.cs
index d32243615..0520d829f 100644
--- a/src/EFCore.PG/Extensions/NpgsqlEntityTypeBuilderExtensions.cs
+++ b/src/EFCore.PG/Extensions/NpgsqlEntityTypeBuilderExtensions.cs
@@ -12,7 +12,15 @@ public static class NpgsqlEntityTypeBuilderExtensions
{
#region xmin
- public static EntityTypeBuilder ForNpgsqlUseXminAsConcurrencyToken(
+ ///
+ /// Configures using the auto-updating system column xmin as the optimistic concurrency token.
+ ///
+ ///
+ /// See http://www.npgsql.org/efcore/miscellaneous.html#optimistic-concurrency-and-concurrency-tokens
+ ///
+ /// The builder for the entity type being configured.
+ /// The same builder instance so that multiple calls can be chained.
+ public static EntityTypeBuilder UseXminAsConcurrencyToken(
[NotNull] this EntityTypeBuilder entityTypeBuilder)
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));
@@ -25,10 +33,18 @@ public static EntityTypeBuilder ForNpgsqlUseXminAsConcurrencyToken(
return entityTypeBuilder;
}
- public static EntityTypeBuilder ForNpgsqlUseXminAsConcurrencyToken(
+ ///
+ /// Configures using the auto-updating system column xmin as the optimistic concurrency token.
+ ///
+ ///
+ /// See http://www.npgsql.org/efcore/miscellaneous.html#optimistic-concurrency-and-concurrency-tokens
+ ///
+ /// The builder for the entity type being configured.
+ /// The same builder instance so that multiple calls can be chained.
+ public static EntityTypeBuilder UseXminAsConcurrencyToken(
[NotNull] this EntityTypeBuilder entityTypeBuilder)
where TEntity : class
- => (EntityTypeBuilder)ForNpgsqlUseXminAsConcurrencyToken((EntityTypeBuilder)entityTypeBuilder);
+ => (EntityTypeBuilder)UseXminAsConcurrencyToken((EntityTypeBuilder)entityTypeBuilder);
#endregion xmin
@@ -44,7 +60,7 @@ public static EntityTypeBuilder ForNpgsqlUseXminAsConcurrencyToken The name of the storage parameter.
/// The value of the storage parameter.
/// The same builder instance so that multiple calls can be chained.
- public static EntityTypeBuilder ForNpgsqlSetStorageParameter(
+ public static EntityTypeBuilder SetStorageParameter(
[NotNull] this EntityTypeBuilder entityTypeBuilder, string parameterName, object parameterValue)
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));
@@ -64,10 +80,10 @@ public static EntityTypeBuilder ForNpgsqlSetStorageParameter(
/// The name of the storage parameter.
/// The value of the storage parameter.
/// The same builder instance so that multiple calls can be chained.
- public static EntityTypeBuilder ForNpgsqlSetStorageParameter(
+ public static EntityTypeBuilder SetStorageParameter(
[NotNull] this EntityTypeBuilder entityTypeBuilder, string parameterName, object parameterValue)
where TEntity : class
- => (EntityTypeBuilder)ForNpgsqlSetStorageParameter((EntityTypeBuilder)entityTypeBuilder, parameterName, parameterValue);
+ => (EntityTypeBuilder)SetStorageParameter((EntityTypeBuilder)entityTypeBuilder, parameterName, parameterValue);
///
/// Sets a PostgreSQL storage parameter on the table created for this entity.
@@ -80,7 +96,7 @@ public static EntityTypeBuilder ForNpgsqlSetStorageParameter(
/// The value of the storage parameter.
/// Indicates whether the configuration was specified using a data annotation.
/// The same builder instance so that multiple calls can be chained.
- public static IConventionEntityTypeBuilder ForNpgsqlSetStorageParameter(
+ public static IConventionEntityTypeBuilder SetStorageParameter(
[NotNull] this IConventionEntityTypeBuilder entityTypeBuilder, string parameterName, object parameterValue, bool fromDataAnnotation = false)
{
if (entityTypeBuilder.ForNpgsqlCanSetStorageParameter(parameterName, parameterValue, fromDataAnnotation))
@@ -151,7 +167,6 @@ public static EntityTypeBuilder ForNpgsqlHasComment(
#region Unlogged Table
- // ReSharper disable once CommentTypo
///
/// Configures the entity to use an unlogged table when targeting Npgsql.
///
@@ -163,7 +178,7 @@ public static EntityTypeBuilder ForNpgsqlHasComment(
///
/// See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED
///
- public static EntityTypeBuilder ForNpgsqlIsUnlogged(
+ public static EntityTypeBuilder IsUnlogged(
[NotNull] this EntityTypeBuilder entityTypeBuilder,
bool isUnlogged = true)
{
@@ -174,7 +189,6 @@ public static EntityTypeBuilder ForNpgsqlIsUnlogged(
return entityTypeBuilder;
}
- // ReSharper disable once CommentTypo
///
/// Configures the mapped table to use an unlogged table when targeting Npgsql.
///
@@ -186,11 +200,11 @@ public static EntityTypeBuilder ForNpgsqlIsUnlogged(
///
/// See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED
///
- public static EntityTypeBuilder ForNpgsqlIsUnlogged(
+ public static EntityTypeBuilder IsUnlogged(
[NotNull] this EntityTypeBuilder entityTypeBuilder,
bool isUnlogged = true)
where TEntity : class
- => (EntityTypeBuilder)ForNpgsqlIsUnlogged((EntityTypeBuilder)entityTypeBuilder, isUnlogged);
+ => (EntityTypeBuilder)IsUnlogged((EntityTypeBuilder)entityTypeBuilder, isUnlogged);
///
/// Configures the mapped table to use an unlogged table when targeting Npgsql.
@@ -204,7 +218,7 @@ public static EntityTypeBuilder ForNpgsqlIsUnlogged(
///
/// See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED
///
- public static IConventionEntityTypeBuilder ForNpgsqlIsUnlogged(
+ public static IConventionEntityTypeBuilder IsUnlogged(
[NotNull] this IConventionEntityTypeBuilder entityTypeBuilder,
bool isUnlogged = true,
bool fromDataAnnotation = false)
@@ -245,7 +259,7 @@ public static bool ForNpgsqlCanSetIsUnlogged(
#region CockroachDB Interleave-in-parent
- public static EntityTypeBuilder ForCockroachDbInterleaveInParent(
+ public static EntityTypeBuilder UseCockroachDbInterleaveInParent(
[NotNull] this EntityTypeBuilder entityTypeBuilder,
[NotNull] Type parentTableType,
[NotNull] List interleavePrefix)
@@ -266,13 +280,121 @@ public static EntityTypeBuilder ForCockroachDbInterleaveInParent(
return entityTypeBuilder;
}
- public static EntityTypeBuilder ForCockroachDbInterleaveInParent(
+ public static EntityTypeBuilder UseCockroachDbInterleaveInParent(
[NotNull] this EntityTypeBuilder entityTypeBuilder,
[NotNull] Type parentTableType,
[NotNull] List interleavePrefix)
where TEntity : class
- => (EntityTypeBuilder)ForCockroachDbInterleaveInParent((EntityTypeBuilder)entityTypeBuilder, parentTableType, interleavePrefix);
+ => (EntityTypeBuilder)UseCockroachDbInterleaveInParent((EntityTypeBuilder)entityTypeBuilder, parentTableType, interleavePrefix);
#endregion CockroachDB Interleave-in-parent
+
+ #region Obsolete
+
+ ///
+ /// Configures using the auto-updating system column xmin as the optimistic concurrency token.
+ ///
+ ///
+ /// See http://www.npgsql.org/efcore/miscellaneous.html#optimistic-concurrency-and-concurrency-tokens
+ ///
+ /// The builder for the entity type being configured.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseXminAsConcurrencyToken")]
+ public static EntityTypeBuilder ForNpgsqlUseXminAsConcurrencyToken([NotNull] this EntityTypeBuilder entityTypeBuilder)
+ => entityTypeBuilder.UseXminAsConcurrencyToken();
+
+ ///
+ /// Configures using the auto-updating system column xmin as the optimistic concurrency token.
+ ///
+ ///
+ /// See http://www.npgsql.org/efcore/miscellaneous.html#optimistic-concurrency-and-concurrency-tokens
+ ///
+ /// The builder for the entity type being configured.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseXminAsConcurrencyToken")]
+ public static EntityTypeBuilder ForNpgsqlUseXminAsConcurrencyToken([NotNull] this EntityTypeBuilder entityTypeBuilder)
+ where TEntity : class
+ => entityTypeBuilder.UseXminAsConcurrencyToken();
+
+ ///
+ /// Sets a PostgreSQL storage parameter on the table created for this entity.
+ ///
+ ///
+ /// See https://www.postgresql.org/docs/current/static/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS
+ ///
+ /// The builder for the entity type being configured.
+ /// The name of the storage parameter.
+ /// The value of the storage parameter.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use SetStorageParameter")]
+ public static EntityTypeBuilder ForNpgsqlSetStorageParameter(
+ [NotNull] this EntityTypeBuilder entityTypeBuilder, string parameterName, object parameterValue)
+ => entityTypeBuilder.SetStorageParameter(parameterName, parameterValue);
+
+ ///
+ /// Sets a PostgreSQL storage parameter on the table created for this entity.
+ ///
+ ///
+ /// See https://www.postgresql.org/docs/current/static/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS
+ ///
+ /// The builder for the entity type being configured.
+ /// The name of the storage parameter.
+ /// The value of the storage parameter.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use SetStorageParameter")]
+ public static EntityTypeBuilder ForNpgsqlSetStorageParameter(
+ [NotNull] this EntityTypeBuilder entityTypeBuilder, string parameterName, object parameterValue)
+ where TEntity : class
+ => entityTypeBuilder.SetStorageParameter(parameterName, parameterValue);
+
+ ///
+ /// Configures the entity to use an unlogged table when targeting Npgsql.
+ ///
+ /// The builder for the entity type being configured.
+ /// True to configure the entity to use an unlogged table; otherwise, false.
+ ///
+ /// The same builder instance so that multiple calls can be chained.
+ ///
+ ///
+ /// See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED
+ ///
+ [Obsolete("Use IsUnlogged")]
+ public static EntityTypeBuilder ForNpgsqlIsUnlogged([NotNull] this EntityTypeBuilder entityTypeBuilder, bool isUnlogged = true)
+ => entityTypeBuilder.IsUnlogged(isUnlogged);
+
+ ///
+ /// Configures the mapped table to use an unlogged table when targeting Npgsql.
+ ///
+ /// The builder for the entity type being configured.
+ /// True to configure the entity to use an unlogged table; otherwise, false.
+ ///
+ /// The same builder instance so that multiple calls can be chained.
+ ///
+ ///
+ /// See: https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED
+ ///
+ [Obsolete("Use IsUnlogged")]
+ public static EntityTypeBuilder ForNpgsqlIsUnlogged(
+ [NotNull] this EntityTypeBuilder entityTypeBuilder,
+ bool isUnlogged = true)
+ where TEntity : class
+ => entityTypeBuilder.IsUnlogged(isUnlogged);
+
+ [Obsolete("Use UseCockroachDbInterleaveInParent")]
+ public static EntityTypeBuilder ForCockroachDbInterleaveInParent(
+ [NotNull] this EntityTypeBuilder entityTypeBuilder,
+ [NotNull] Type parentTableType,
+ [NotNull] List interleavePrefix)
+ => entityTypeBuilder.UseCockroachDbInterleaveInParent(parentTableType, interleavePrefix);
+
+ [Obsolete("Use UseCockroachDbInterleaveInParent")]
+ public static EntityTypeBuilder ForCockroachDbInterleaveInParent(
+ [NotNull] this EntityTypeBuilder entityTypeBuilder,
+ [NotNull] Type parentTableType,
+ [NotNull] List interleavePrefix)
+ where TEntity : class
+ => entityTypeBuilder.UseCockroachDbInterleaveInParent(parentTableType, interleavePrefix);
+
+ #endregion Obsolete
}
}
diff --git a/src/EFCore.PG/Extensions/NpgsqlIndexBuilderExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlIndexBuilderExtensions.cs
index 947919816..1d6937742 100644
--- a/src/EFCore.PG/Extensions/NpgsqlIndexBuilderExtensions.cs
+++ b/src/EFCore.PG/Extensions/NpgsqlIndexBuilderExtensions.cs
@@ -31,7 +31,7 @@ public static class NpgsqlIndexBuilderExtensions
/// The builder for the index being configured.
/// The name of the index.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasMethod(
+ public static IndexBuilder HasMethod(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull] string method)
{
@@ -52,10 +52,10 @@ public static IndexBuilder ForNpgsqlHasMethod(
/// The builder for the index being configured.
/// The name of the index.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasMethod(
+ public static IndexBuilder HasMethod(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull] string method)
- => (IndexBuilder)ForNpgsqlHasMethod((IndexBuilder)indexBuilder, method);
+ => (IndexBuilder)HasMethod((IndexBuilder)indexBuilder, method);
///
/// The PostgreSQL index method to be used. Null selects the default (currently btree).
@@ -67,7 +67,7 @@ public static IndexBuilder ForNpgsqlHasMethod(
/// The name of the index.
/// Indicates whether the configuration was specified using a data annotation.
/// A builder to further configure the index.
- public static IConventionIndexBuilder ForNpgsqlHasMethod(
+ public static IConventionIndexBuilder HasMethod(
[NotNull] this IConventionIndexBuilder indexBuilder,
[CanBeNull] string method,
bool fromDataAnnotation = false)
@@ -115,7 +115,7 @@ public static bool ForNpgsqlCanSetHasMethod(
/// The builder for the index being configured.
/// The operators to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasOperators(
+ public static IndexBuilder HasOperators(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull, ItemNotNull] params string[] operators)
{
@@ -136,10 +136,10 @@ public static IndexBuilder ForNpgsqlHasOperators(
/// The builder for the index being configured.
/// The operators to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasOperators(
+ public static IndexBuilder HasOperators(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull, ItemNotNull] params string[] operators)
- => (IndexBuilder)ForNpgsqlHasOperators((IndexBuilder)indexBuilder, operators);
+ => (IndexBuilder)HasOperators((IndexBuilder)indexBuilder, operators);
///
/// The PostgreSQL index operators to be used.
@@ -151,7 +151,7 @@ public static IndexBuilder ForNpgsqlHasOperators(
/// The operators to use for each column.
/// Indicates whether the configuration was specified using a data annotation.
/// A builder to further configure the index.
- public static IConventionIndexBuilder ForNpgsqlHasOperators(
+ public static IConventionIndexBuilder HasOperators(
[NotNull] this IConventionIndexBuilder indexBuilder,
[CanBeNull, ItemNotNull] IReadOnlyList operators,
bool fromDataAnnotation)
@@ -199,7 +199,7 @@ public static bool ForNpgsqlCanSetHasOperators(
/// The builder for the index being configured.
/// The sort options to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasCollation(
+ public static IndexBuilder HasCollation(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull, ItemNotNull] params string[] values)
{
@@ -220,10 +220,10 @@ public static IndexBuilder ForNpgsqlHasCollation(
/// The builder for the index being configured.
/// The sort options to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasCollation(
+ public static IndexBuilder HasCollation(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull, ItemNotNull] params string[] values)
- => (IndexBuilder)ForNpgsqlHasCollation((IndexBuilder)indexBuilder, values);
+ => (IndexBuilder)HasCollation((IndexBuilder)indexBuilder, values);
///
/// The PostgreSQL index collation to be used.
@@ -235,7 +235,7 @@ public static IndexBuilder ForNpgsqlHasCollation(
/// The sort options to use for each column.
/// Indicates whether the configuration was specified using a data annotation.
/// A builder to further configure the index.
- public static IConventionIndexBuilder ForNpgsqlHasCollation(
+ public static IConventionIndexBuilder HasCollation(
[NotNull] this IConventionIndexBuilder indexBuilder,
[CanBeNull, ItemNotNull] IReadOnlyList values,
bool fromDataAnnotation)
@@ -283,7 +283,7 @@ public static bool ForNpgsqlCanSetHasCollation(
/// The builder for the index being configured.
/// The sort order to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasSortOrder(
+ public static IndexBuilder HasSortOrder(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull] params SortOrder[] values)
{
@@ -305,10 +305,10 @@ public static IndexBuilder ForNpgsqlHasSortOrder(
/// The builder for the index being configured.
/// The sort order to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasSortOrder(
+ public static IndexBuilder HasSortOrder(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull] params SortOrder[] values)
- => (IndexBuilder)ForNpgsqlHasSortOrder((IndexBuilder)indexBuilder, values);
+ => (IndexBuilder)HasSortOrder((IndexBuilder)indexBuilder, values);
///
/// The PostgreSQL index sort ordering to be used.
@@ -320,7 +320,7 @@ public static IndexBuilder ForNpgsqlHasSortOrder(
/// Indicates whether the configuration was specified using a data annotation.
/// The sort order to use for each column.
/// A builder to further configure the index.
- public static IConventionIndexBuilder ForNpgsqlHasSortOrder(
+ public static IConventionIndexBuilder HasSortOrder(
[NotNull] this IConventionIndexBuilder indexBuilder,
[CanBeNull] IReadOnlyList values,
bool fromDataAnnotation)
@@ -372,7 +372,7 @@ public static bool ForNpgsqlCanSetHasSortOrder(
/// The builder for the index being configured.
/// The sort order to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasNullSortOrder(
+ public static IndexBuilder HasNullSortOrder(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull] params NullSortOrder[] values)
{
@@ -396,10 +396,10 @@ public static IndexBuilder ForNpgsqlHasNullSortOrder(
/// The builder for the index being configured.
/// The sort order to use for each column.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlHasNullSortOrder(
+ public static IndexBuilder HasNullSortOrder(
[NotNull] this IndexBuilder indexBuilder,
[CanBeNull] params NullSortOrder[] values)
- => (IndexBuilder)ForNpgsqlHasNullSortOrder((IndexBuilder)indexBuilder, values);
+ => (IndexBuilder)HasNullSortOrder((IndexBuilder)indexBuilder, values);
///
/// The PostgreSQL index NULL sort ordering to be used.
@@ -411,7 +411,7 @@ public static IndexBuilder ForNpgsqlHasNullSortOrder(
/// The sort order to use for each column.
/// Indicates whether the configuration was specified using a data annotation.
/// A builder to further configure the index.
- public static IConventionIndexBuilder ForNpgsqlHasNullSortOrder(
+ public static IConventionIndexBuilder HasNullSortOrder(
[NotNull] this IConventionIndexBuilder indexBuilder,
IReadOnlyList values,
bool fromDataAnnotation)
@@ -463,7 +463,7 @@ public static bool ForNpgsqlCanSetHasNullSortOrder(
/// The builder for the index being configured.
/// An array of property names to be used in INCLUDE clause.
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlInclude(
+ public static IndexBuilder IncludeProperties(
[NotNull] this IndexBuilder indexBuilder,
[NotNull, ItemNotNull] params string[] propertyNames)
{
@@ -494,14 +494,14 @@ public static IndexBuilder ForNpgsqlInclude(
///
///
/// A builder to further configure the index.
- public static IndexBuilder ForNpgsqlInclude(
+ public static IndexBuilder IncludeProperties(
[NotNull] this IndexBuilder indexBuilder,
[NotNull] Expression> includeExpression)
{
Check.NotNull(indexBuilder, nameof(indexBuilder));
Check.NotNull(includeExpression, nameof(includeExpression));
- indexBuilder.ForNpgsqlInclude(includeExpression.GetPropertyAccessList().Select(x => x.Name).ToArray());
+ indexBuilder.IncludeProperties(includeExpression.GetPropertyAccessList().Select(x => x.Name).ToArray());
return indexBuilder;
}
@@ -517,7 +517,7 @@ public static IndexBuilder ForNpgsqlInclude(
/// An array of property names to be used in INCLUDE clause.
/// Indicates whether the configuration was specified using a data annotation.
/// A builder to further configure the index.
- public static IConventionIndexBuilder ForNpgsqlInclude(
+ public static IConventionIndexBuilder IncludeProperties(
[NotNull] this IConventionIndexBuilder indexBuilder,
[NotNull] IReadOnlyList propertyNames,
bool fromDataAnnotation = false)
@@ -553,5 +553,111 @@ public static bool ForNpgsqlCanSetInclude(
}
#endregion Include
+
+ #region Obsolete
+
+ ///
+ /// The PostgreSQL index method to be used. Null selects the default (currently btree).
+ ///
+ ///
+ /// http://www.postgresql.org/docs/current/static/sql-createindex.html
+ ///
+ /// The builder for the index being configured.
+ /// The name of the index.
+ /// A builder to further configure the index.
+ [Obsolete("Use HasMethod")]
+ public static IndexBuilder ForNpgsqlHasMethod([NotNull] this IndexBuilder indexBuilder, [CanBeNull] string method)
+ => indexBuilder.HasMethod(method);
+
+ ///
+ /// The PostgreSQL index operators to be used.
+ ///
+ ///
+ /// https://www.postgresql.org/docs/current/static/indexes-opclass.html
+ ///
+ /// The builder for the index being configured.
+ /// The operators to use for each column.
+ /// A builder to further configure the index.
+ [Obsolete("Use HasOperators")]
+ public static IndexBuilder ForNpgsqlHasOperators([NotNull] this IndexBuilder indexBuilder, [CanBeNull, ItemNotNull] params string[] operators)
+ => indexBuilder.HasOperators(operators);
+
+ ///
+ /// The PostgreSQL index collation to be used.
+ ///
+ ///
+ /// https://www.postgresql.org/docs/current/static/indexes-collations.html
+ ///
+ /// The builder for the index being configured.
+ /// The sort options to use for each column.
+ /// A builder to further configure the index.
+ [Obsolete("Use HasCollation")]
+ public static IndexBuilder ForNpgsqlHasCollation([NotNull] this IndexBuilder indexBuilder, [CanBeNull, ItemNotNull] params string[] values)
+ => indexBuilder.HasCollation(values);
+
+ ///
+ /// The PostgreSQL index sort ordering to be used.
+ ///
+ ///
+ /// https://www.postgresql.org/docs/current/static/indexes-ordering.html
+ ///
+ /// The builder for the index being configured.
+ /// The sort order to use for each column.
+ /// A builder to further configure the index.
+ [Obsolete("Use HasSortOrder")]
+ public static IndexBuilder ForNpgsqlHasSortOrder([NotNull] this IndexBuilder indexBuilder, [CanBeNull] params SortOrder[] values)
+ => indexBuilder.HasSortOrder(values);
+
+ ///
+ /// The PostgreSQL index NULL sort ordering to be used.
+ ///
+ ///
+ /// https://www.postgresql.org/docs/current/static/indexes-ordering.html
+ ///
+ /// The builder for the index being configured.
+ /// The sort order to use for each column.
+ /// A builder to further configure the index.
+ [Obsolete("Use HasNullSortOrder")]
+ public static IndexBuilder ForNpgsqlHasNullSortOrder([NotNull] this IndexBuilder indexBuilder, [CanBeNull] params NullSortOrder[] values)
+ => indexBuilder.HasNullSortOrder(values);
+
+ ///
+ /// Adds an INCLUDE clause to the index definition with the specified property names.
+ /// This clause specifies a list of columns which will be included as a non-key part in the index.
+ ///
+ ///
+ /// https://www.postgresql.org/docs/current/sql-createindex.html
+ ///
+ /// The builder for the index being configured.
+ /// An array of property names to be used in INCLUDE clause.
+ /// A builder to further configure the index.
+ [Obsolete("Use IncludeProperties")]
+ public static IndexBuilder ForNpgsqlInclude([NotNull] this IndexBuilder indexBuilder, [NotNull, ItemNotNull] params string[] propertyNames)
+ => indexBuilder.IncludeProperties(propertyNames);
+
+ ///
+ /// Adds an INCLUDE clause to the index definition with property names from the specified expression.
+ /// This clause specifies a list of columns which will be included as a non-key part in the index.
+ ///
+ ///
+ /// https://www.postgresql.org/docs/current/sql-createindex.html
+ ///
+ /// The builder for the index being configured.
+ ///
+ ///
+ /// A lambda expression representing the property(s) to be included in the INCLUDE clause
+ /// (blog => blog.Url).
+ ///
+ ///
+ /// If multiple properties are to be included then specify an anonymous type including the
+ /// properties (post => new { post.Title, post.BlogId }).
+ ///
+ ///
+ /// A builder to further configure the index.
+ [Obsolete("Use IncludeProperties")]
+ public static IndexBuilder ForNpgsqlInclude([NotNull] this IndexBuilder indexBuilder, [NotNull] Expression> includeExpression)
+ => indexBuilder.IncludeProperties(includeExpression);
+
+ #endregion Obsolete
}
}
diff --git a/src/EFCore.PG/Extensions/NpgsqlModelBuilderExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlModelBuilderExtensions.cs
index f0c8c81ac..26f938f02 100644
--- a/src/EFCore.PG/Extensions/NpgsqlModelBuilderExtensions.cs
+++ b/src/EFCore.PG/Extensions/NpgsqlModelBuilderExtensions.cs
@@ -20,7 +20,7 @@ namespace Microsoft.EntityFrameworkCore
[PublicAPI]
public static class NpgsqlModelBuilderExtensions
{
- #region Sequences
+ #region HiLo
///
/// Configures the model to use a sequence-based hi-lo pattern to generate values for properties
@@ -30,7 +30,7 @@ public static class NpgsqlModelBuilderExtensions
/// The name of the sequence.
/// The schema of the sequence.
/// The same builder instance so that multiple calls can be chained.
- public static ModelBuilder ForNpgsqlUseSequenceHiLo(
+ public static ModelBuilder UseHiLo(
[NotNull] this ModelBuilder modelBuilder,
[CanBeNull] string name = null,
[CanBeNull] string schema = null)
@@ -64,13 +64,13 @@ public static ModelBuilder ForNpgsqlUseSequenceHiLo(
/// The schema of the sequence.
/// Indicates whether the configuration was specified using a data annotation.
/// A builder to further configure the sequence.
- public static IConventionSequenceBuilder ForNpgsqlHasHiLoSequence(
+ public static IConventionSequenceBuilder HasHiLoSequence(
[NotNull] this IConventionModelBuilder modelBuilder,
[CanBeNull] string name,
[CanBeNull] string schema,
bool fromDataAnnotation = false)
{
- if (!modelBuilder.ForNpgsqlCanSetHiLoSequence(name, schema))
+ if (!modelBuilder.CanSetHiLoSequence(name, schema))
{
return null;
}
@@ -89,7 +89,7 @@ public static IConventionSequenceBuilder ForNpgsqlHasHiLoSequence(
/// The schema of the sequence.
/// Indicates whether the configuration was specified using a data annotation.
/// true if the given name and schema can be set for the hi-lo sequence.
- public static bool ForNpgsqlCanSetHiLoSequence(
+ public static bool CanSetHiLoSequence(
[NotNull] this IConventionModelBuilder modelBuilder,
[CanBeNull] string name,
[CanBeNull] string schema,
@@ -103,6 +103,10 @@ public static bool ForNpgsqlCanSetHiLoSequence(
&& modelBuilder.CanSetAnnotation(NpgsqlAnnotationNames.HiLoSequenceSchema, schema, fromDataAnnotation);
}
+ #endregion HiLo
+
+ #region Serial
+
///
/// Configures the model to use the PostgreSQL SERIAL feature to generate values for properties
/// marked as , when targeting PostgreSQL. This is the default
@@ -110,7 +114,7 @@ public static bool ForNpgsqlCanSetHiLoSequence(
///
/// The model builder.
/// The same builder instance so that multiple calls can be chained.
- public static ModelBuilder ForNpgsqlUseSerialColumns(
+ public static ModelBuilder UseSerialColumns(
[NotNull] this ModelBuilder modelBuilder)
{
Check.NotNull(modelBuilder, nameof(modelBuilder));
@@ -124,7 +128,7 @@ public static ModelBuilder ForNpgsqlUseSerialColumns(
return modelBuilder;
}
- #endregion
+ #endregion Serial
#region Identity
@@ -139,7 +143,7 @@ public static ModelBuilder ForNpgsqlUseSerialColumns(
///
/// The model builder.
/// The same builder instance so that multiple calls can be chained.
- public static ModelBuilder ForNpgsqlUseIdentityAlwaysColumns(
+ public static ModelBuilder UseIdentityAlwaysColumns(
[NotNull] this ModelBuilder modelBuilder)
{
Check.NotNull(modelBuilder, nameof(modelBuilder));
@@ -164,7 +168,7 @@ public static ModelBuilder ForNpgsqlUseIdentityAlwaysColumns(
///
/// The model builder.
/// The same builder instance so that multiple calls can be chained.
- public static ModelBuilder ForNpgsqlUseIdentityByDefaultColumns(
+ public static ModelBuilder UseIdentityByDefaultColumns(
[NotNull] this ModelBuilder modelBuilder)
{
Check.NotNull(modelBuilder, nameof(modelBuilder));
@@ -189,9 +193,9 @@ public static ModelBuilder ForNpgsqlUseIdentityByDefaultColumns(
///
/// The model builder.
/// The same builder instance so that multiple calls can be chained.
- public static ModelBuilder ForNpgsqlUseIdentityColumns(
+ public static ModelBuilder UseIdentityColumns(
[NotNull] this ModelBuilder modelBuilder)
- => modelBuilder.ForNpgsqlUseIdentityByDefaultColumns();
+ => modelBuilder.UseIdentityByDefaultColumns();
///
/// Configures the value generation strategy for the key property, when targeting PostgreSQL.
@@ -202,7 +206,7 @@ public static ModelBuilder ForNpgsqlUseIdentityColumns(
///
/// The same builder instance if the configuration was applied, null otherwise.
///
- public static IConventionModelBuilder ForNpgsqlHasValueGenerationStrategy(
+ public static IConventionModelBuilder HasValueGenerationStrategy(
[NotNull] this IConventionModelBuilder modelBuilder,
NpgsqlValueGenerationStrategy? valueGenerationStrategy,
bool fromDataAnnotation = false)
@@ -213,7 +217,7 @@ public static IConventionModelBuilder ForNpgsqlHasValueGenerationStrategy(
modelBuilder.Metadata.SetNpgsqlValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation);
if (valueGenerationStrategy != NpgsqlValueGenerationStrategy.SequenceHiLo)
{
- modelBuilder.ForNpgsqlHasHiLoSequence(null, null, fromDataAnnotation);
+ modelBuilder.HasHiLoSequence(null, null, fromDataAnnotation);
}
return modelBuilder;
@@ -293,7 +297,7 @@ public static ModelBuilder HasPostgresExtension(
///
/// builder
[NotNull]
- public static ModelBuilder ForNpgsqlHasEnum(
+ public static ModelBuilder HasPostgresEnum(
[NotNull] this ModelBuilder modelBuilder,
[CanBeNull] string schema,
[NotNull] string name,
@@ -321,11 +325,11 @@ public static ModelBuilder ForNpgsqlHasEnum(
///
/// builder
[NotNull]
- public static ModelBuilder ForNpgsqlHasEnum(
+ public static ModelBuilder HasPostgresEnum(
[NotNull] this ModelBuilder modelBuilder,
[NotNull] string name,
[NotNull] string[] labels)
- => modelBuilder.ForNpgsqlHasEnum(null, name, labels);
+ => modelBuilder.HasPostgresEnum(null, name, labels);
///
/// Registers a user-defined enum type in the model.
@@ -345,7 +349,7 @@ public static ModelBuilder ForNpgsqlHasEnum(
///
/// builder
[NotNull]
- public static ModelBuilder ForNpgsqlHasEnum(
+ public static ModelBuilder HasPostgresEnum(
[NotNull] this ModelBuilder modelBuilder,
[CanBeNull] string schema = null,
[CanBeNull] string name = null,
@@ -355,7 +359,7 @@ public static ModelBuilder ForNpgsqlHasEnum(
if (nameTranslator == null)
nameTranslator = NpgsqlConnection.GlobalTypeMapper.DefaultNameTranslator;
- return modelBuilder.ForNpgsqlHasEnum(
+ return modelBuilder.HasPostgresEnum(
schema,
name ?? GetTypePgName(nameTranslator),
GetMemberPgNames(nameTranslator));
@@ -365,7 +369,7 @@ public static ModelBuilder ForNpgsqlHasEnum(
#region Templates
- public static ModelBuilder HasDatabaseTemplate(
+ public static ModelBuilder UseDatabaseTemplate(
[NotNull] this ModelBuilder modelBuilder,
[NotNull] string templateDatabaseName)
{
@@ -401,7 +405,7 @@ public static ModelBuilder HasDatabaseTemplate(
/// https://www.postgresql.org/docs/current/static/sql-createtype.html,
///
[NotNull]
- public static ModelBuilder ForNpgsqlHasRange(
+ public static ModelBuilder HasPostgresRange(
[NotNull] this ModelBuilder modelBuilder,
[CanBeNull] string schema,
[NotNull] string name,
@@ -436,17 +440,17 @@ public static ModelBuilder ForNpgsqlHasRange(
/// See https://www.postgresql.org/docs/current/static/rangetypes.html,
/// https://www.postgresql.org/docs/current/static/sql-createtype.html,
///
- public static ModelBuilder ForNpgsqlHasRange(
+ public static ModelBuilder HasPostgresRange(
[NotNull] this ModelBuilder modelBuilder,
[NotNull] string name,
[NotNull] string subtype)
- => ForNpgsqlHasRange(modelBuilder, null, name, subtype);
+ => HasPostgresRange(modelBuilder, null, name, subtype);
#endregion
#region Tablespaces
- public static ModelBuilder ForNpgsqlUseTablespace(
+ public static ModelBuilder UseTablespace(
[NotNull] this ModelBuilder modelBuilder,
[NotNull] string tablespace)
{
@@ -478,5 +482,202 @@ static string[] GetMemberPgNames([NotNull] INpgsqlNameTranslator nameTran
.ToArray();
#endregion
+
+ #region Obsolete
+
+ ///
+ /// Configures the model to use a sequence-based hi-lo pattern to generate values for properties
+ /// marked as , when targeting PostgreSQL.
+ ///
+ /// The model builder.
+ /// The name of the sequence.
+ /// The schema of the sequence.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseHiLo")]
+ public static ModelBuilder ForNpgsqlUseSequenceHiLo([NotNull] this ModelBuilder modelBuilder, [CanBeNull] string name = null, [CanBeNull] string schema = null)
+ => modelBuilder.UseHiLo(name, schema);
+
+ ///
+ /// Configures the model to use the PostgreSQL SERIAL feature to generate values for properties
+ /// marked as , when targeting PostgreSQL. This is the default
+ /// behavior when targeting PostgreSQL.
+ ///
+ /// The model builder.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseSerialColumns")]
+ public static ModelBuilder ForNpgsqlUseSerialColumns([NotNull] this ModelBuilder modelBuilder)
+ => modelBuilder.UseSerialColumns();
+
+ ///
+ ///
+ /// Configures the model to use the PostgreSQL IDENTITY feature to generate values for properties
+ /// marked as , when targeting PostgreSQL. Values for these
+ /// columns will always be generated as identity, and the application will not be able to override
+ /// this behavior by providing a value.
+ ///
+ /// Available only starting PostgreSQL 10.
+ ///
+ /// The model builder.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseIdentityAlwaysColumns")]
+ public static ModelBuilder ForNpgsqlUseIdentityAlwaysColumns([NotNull] this ModelBuilder modelBuilder)
+ => modelBuilder.UseIdentityAlwaysColumns();
+
+ ///
+ ///
+ /// Configures the model to use the PostgreSQL IDENTITY feature to generate values for properties
+ /// marked as , when targeting PostgreSQL. Values for these
+ /// columns will be generated as identity by default, but the application will be able to override
+ /// this behavior by providing a value.
+ ///
+ /// Available only starting PostgreSQL 10.
+ ///
+ /// The model builder.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseIdentityByDefaultColumns")]
+ public static ModelBuilder ForNpgsqlUseIdentityByDefaultColumns([NotNull] this ModelBuilder modelBuilder)
+ => modelBuilder.UseIdentityByDefaultColumns();
+
+ ///
+ ///
+ /// Configures the model to use the PostgreSQL IDENTITY feature to generate values for properties
+ /// marked as , when targeting PostgreSQL. Values for these
+ /// columns will be generated as identity by default, but the application will be able to override
+ /// this behavior by providing a value.
+ ///
+ /// Available only starting PostgreSQL 10.
+ ///
+ /// The model builder.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseIdentityColumns")]
+ public static ModelBuilder ForNpgsqlUseIdentityColumns([NotNull] this ModelBuilder modelBuilder)
+ => modelBuilder.UseIdentityColumns();
+
+ ///
+ /// Registers a user-defined enum type in the model.
+ ///
+ /// The model builder in which to create the enum type.
+ /// The schema in which to create the enum type.
+ /// The name of the enum type to create.
+ /// The enum label values.
+ ///
+ /// The updated .
+ ///
+ ///
+ /// See: https://www.postgresql.org/docs/current/static/datatype-enum.html
+ ///
+ /// builder
+ [Obsolete("Use HasPostgresEnum")]
+ public static ModelBuilder ForNpgsqlHasEnum(
+ [NotNull] this ModelBuilder modelBuilder,
+ [CanBeNull] string schema,
+ [NotNull] string name,
+ [NotNull] string[] labels)
+ => modelBuilder.HasPostgresEnum(schema, name, labels);
+
+ ///
+ /// Registers a user-defined enum type in the model.
+ ///
+ /// The model builder in which to create the enum type.
+ /// The name of the enum type to create.
+ /// The enum label values.
+ ///
+ /// The updated .
+ ///
+ ///
+ /// See: https://www.postgresql.org/docs/current/static/datatype-enum.html
+ ///
+ /// builder
+ [Obsolete("Use HasPostgresEnum")]
+ public static ModelBuilder ForNpgsqlHasEnum(
+ [NotNull] this ModelBuilder modelBuilder,
+ [NotNull] string name,
+ [NotNull] string[] labels)
+ => modelBuilder.HasPostgresEnum(name, labels);
+
+ ///
+ /// Registers a user-defined enum type in the model.
+ ///
+ /// The model builder in which to create the enum type.
+ /// The schema in which to create the enum type.
+ /// The name of the enum type to create.
+ ///
+ /// The translator for name and label inference.
+ /// Defaults to .
+ ///
+ ///
+ /// The updated .
+ ///
+ ///
+ /// See: https://www.postgresql.org/docs/current/static/datatype-enum.html
+ ///
+ /// builder
+ [Obsolete("Use HasPostgresEnum")]
+ public static ModelBuilder ForNpgsqlHasEnum(
+ [NotNull] this ModelBuilder modelBuilder,
+ [CanBeNull] string schema = null,
+ [CanBeNull] string name = null,
+ [CanBeNull] INpgsqlNameTranslator nameTranslator = null)
+ where TEnum : struct, Enum
+ => modelBuilder.HasPostgresEnum(schema, name, nameTranslator);
+
+ [Obsolete("Use UseDatabaseTemplate")]
+ public static ModelBuilder HasDatabaseTemplate([NotNull] this ModelBuilder modelBuilder, [NotNull] string templateDatabaseName)
+ => modelBuilder.UseDatabaseTemplate(templateDatabaseName);
+
+ ///
+ /// Registers a user-defined range type in the model.
+ ///
+ /// The model builder on which to create the range type.
+ /// The schema in which to create the range type.
+ /// The name of the range type to be created.
+ /// The subtype (or element type) of the range
+ ///
+ /// An optional PostgreSQL function which converts range values to a canonical form.
+ ///
+ /// Used to specify a non-default operator class.
+ /// Used to specify a non-default collation in the range's order.
+ ///
+ /// An optional PostgreSQL function taking two values of the subtype type as argument, and return a double
+ /// precision value representing the difference between the two given values.
+ ///
+ ///
+ /// See https://www.postgresql.org/docs/current/static/rangetypes.html,
+ /// https://www.postgresql.org/docs/current/static/sql-createtype.html,
+ ///
+ [Obsolete("Use HasPostgresRange")]
+ public static ModelBuilder ForNpgsqlHasRange(
+ [NotNull] this ModelBuilder modelBuilder,
+ [CanBeNull] string schema,
+ [NotNull] string name,
+ [NotNull] string subtype,
+ string canonicalFunction = null,
+ string subtypeOpClass = null,
+ string collation = null,
+ string subtypeDiff = null)
+ => modelBuilder.HasPostgresRange(schema, name, subtype, canonicalFunction, subtype, collation, subtypeDiff);
+
+ ///
+ /// Registers a user-defined range type in the model.
+ ///
+ /// The model builder on which to create the range type.
+ /// The name of the range type to be created.
+ /// The subtype (or element type) of the range
+ ///
+ /// See https://www.postgresql.org/docs/current/static/rangetypes.html,
+ /// https://www.postgresql.org/docs/current/static/sql-createtype.html,
+ ///
+ [Obsolete("Use HasPostgresRange")]
+ public static ModelBuilder ForNpgsqlHasRange(
+ [NotNull] this ModelBuilder modelBuilder,
+ [NotNull] string name,
+ [NotNull] string subtype)
+ => modelBuilder.HasPostgresRange(name, subtype);
+
+ [Obsolete("Use UseTablespace")]
+ public static ModelBuilder ForNpgsqlUseTablespace([NotNull] this ModelBuilder modelBuilder, [NotNull] string tablespace)
+ => modelBuilder.UseTablespace(tablespace);
+
+ #endregion Obsolete
}
}
diff --git a/src/EFCore.PG/Extensions/NpgsqlModelExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlModelExtensions.cs
index 3e679b6ff..37b64dda4 100644
--- a/src/EFCore.PG/Extensions/NpgsqlModelExtensions.cs
+++ b/src/EFCore.PG/Extensions/NpgsqlModelExtensions.cs
@@ -60,7 +60,7 @@ public static void SetNpgsqlHiLoSequenceName(
///
/// Returns the schema to use for the default hi-lo sequence.
- ///
+ ///
///
/// The model.
/// The schema to use for the default hi-lo sequence.
diff --git a/src/EFCore.PG/Extensions/NpgsqlPropertyBuilderExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlPropertyBuilderExtensions.cs
index 7e7f11fcb..c0b3b8d84 100644
--- a/src/EFCore.PG/Extensions/NpgsqlPropertyBuilderExtensions.cs
+++ b/src/EFCore.PG/Extensions/NpgsqlPropertyBuilderExtensions.cs
@@ -24,7 +24,7 @@ public static class NpgsqlPropertyBuilderExtensions
/// The comment of the sequence.
/// The schema of the sequence.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseSequenceHiLo(
+ public static PropertyBuilder UseHiLo(
[NotNull] this PropertyBuilder propertyBuilder,
[CanBeNull] string name = null,
[CanBeNull] string schema = null)
@@ -59,11 +59,11 @@ public static PropertyBuilder ForNpgsqlUseSequenceHiLo(
/// The comment of the sequence.
/// The schema of the sequence.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseSequenceHiLo(
+ public static PropertyBuilder UseHiLo(
[NotNull] this PropertyBuilder propertyBuilder,
[CanBeNull] string name = null,
[CanBeNull] string schema = null)
- => (PropertyBuilder)ForNpgsqlUseSequenceHiLo((PropertyBuilder)propertyBuilder, name, schema);
+ => (PropertyBuilder)UseHiLo((PropertyBuilder)propertyBuilder, name, schema);
///
/// Configures the database sequence used for the hi-lo pattern to generate values for the key property,
@@ -74,13 +74,13 @@ public static PropertyBuilder ForNpgsqlUseSequenceHiLo(
/// The schema of the sequence.
/// Indicates whether the configuration was specified using a data annotation.
/// A builder to further configure the sequence.
- public static IConventionSequenceBuilder ForNpgsqlHasHiLoSequence(
+ public static IConventionSequenceBuilder HasHiLoSequence(
[NotNull] this IConventionPropertyBuilder propertyBuilder,
[CanBeNull] string name,
[CanBeNull] string schema,
bool fromDataAnnotation = false)
{
- if (!propertyBuilder.ForNpgsqlCanSetHiLoSequence(name, schema))
+ if (!propertyBuilder.CanSetHiLoSequence(name, schema))
{
return null;
}
@@ -101,7 +101,7 @@ public static IConventionSequenceBuilder ForNpgsqlHasHiLoSequence(
/// The schema of the sequence.
/// Indicates whether the configuration was specified using a data annotation.
/// true if the given name and schema can be set for the hi-lo sequence.
- public static bool ForNpgsqlCanSetHiLoSequence(
+ public static bool CanSetHiLoSequence(
[NotNull] this IConventionPropertyBuilder propertyBuilder,
[CanBeNull] string name,
[CanBeNull] string schema,
@@ -125,7 +125,7 @@ public static bool ForNpgsqlCanSetHiLoSequence(
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseSerialColumn(
+ public static PropertyBuilder UseSerialColumn(
[NotNull] this PropertyBuilder propertyBuilder)
{
Check.NotNull(propertyBuilder, nameof(propertyBuilder));
@@ -145,9 +145,9 @@ public static PropertyBuilder ForNpgsqlUseSerialColumn(
/// The type of the property being configured.
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseSerialColumn(
+ public static PropertyBuilder UseSerialColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => (PropertyBuilder)ForNpgsqlUseSerialColumn((PropertyBuilder)propertyBuilder);
+ => (PropertyBuilder)UseSerialColumn((PropertyBuilder)propertyBuilder);
///
/// Configures the property to use the PostgreSQL SERIAL feature to generate values for new entities,
@@ -155,10 +155,10 @@ public static PropertyBuilder ForNpgsqlUseSerialColumn(
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static IConventionPropertyBuilder ForNpgsqlUseSerialColumn(
+ public static IConventionPropertyBuilder UseSerialColumn(
[NotNull] this IConventionPropertyBuilder propertyBuilder)
{
- if (propertyBuilder.ForNpgsqlCanSetValueGenerationStrategy(NpgsqlValueGenerationStrategy.SerialColumn))
+ if (propertyBuilder.CanSetValueGenerationStrategy(NpgsqlValueGenerationStrategy.SerialColumn))
{
var property = propertyBuilder.Metadata;
property.SetNpgsqlValueGenerationStrategy(NpgsqlValueGenerationStrategy.SerialColumn);
@@ -186,7 +186,7 @@ public static IConventionPropertyBuilder ForNpgsqlUseSerialColumn(
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseIdentityAlwaysColumn([NotNull] this PropertyBuilder propertyBuilder)
+ public static PropertyBuilder UseIdentityAlwaysColumn([NotNull] this PropertyBuilder propertyBuilder)
{
Check.NotNull(propertyBuilder, nameof(propertyBuilder));
@@ -209,9 +209,9 @@ public static PropertyBuilder ForNpgsqlUseIdentityAlwaysColumn([NotNull] this Pr
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseIdentityAlwaysColumn(
+ public static PropertyBuilder UseIdentityAlwaysColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => (PropertyBuilder)ForNpgsqlUseIdentityAlwaysColumn((PropertyBuilder)propertyBuilder);
+ => (PropertyBuilder)UseIdentityAlwaysColumn((PropertyBuilder)propertyBuilder);
///
///
@@ -224,9 +224,9 @@ public static PropertyBuilder ForNpgsqlUseIdentityAlwaysColumn
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static IConventionPropertyBuilder ForNpgsqlUseIdentityAlwaysColumn([NotNull] this IConventionPropertyBuilder propertyBuilder)
+ public static IConventionPropertyBuilder UseIdentityAlwaysColumn([NotNull] this IConventionPropertyBuilder propertyBuilder)
{
- if (propertyBuilder.ForNpgsqlCanSetValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityAlwaysColumn))
+ if (propertyBuilder.CanSetValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityAlwaysColumn))
{
var property = propertyBuilder.Metadata;
property.SetNpgsqlValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
@@ -254,7 +254,7 @@ public static IConventionPropertyBuilder ForNpgsqlUseIdentityAlwaysColumn([NotNu
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseIdentityByDefaultColumn([NotNull] this PropertyBuilder propertyBuilder)
+ public static PropertyBuilder UseIdentityByDefaultColumn([NotNull] this PropertyBuilder propertyBuilder)
{
Check.NotNull(propertyBuilder, nameof(propertyBuilder));
@@ -278,9 +278,9 @@ public static PropertyBuilder ForNpgsqlUseIdentityByDefaultColumn([NotNull] this
/// The type of the property being configured.
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseIdentityByDefaultColumn(
+ public static PropertyBuilder UseIdentityByDefaultColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => (PropertyBuilder)ForNpgsqlUseIdentityByDefaultColumn((PropertyBuilder)propertyBuilder);
+ => (PropertyBuilder)UseIdentityByDefaultColumn((PropertyBuilder)propertyBuilder);
///
///
@@ -293,9 +293,9 @@ public static PropertyBuilder ForNpgsqlUseIdentityByDefaultColumn
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static IConventionPropertyBuilder ForNpgsqlUseIdentityByDefaultColumn([NotNull] this IConventionPropertyBuilder propertyBuilder)
+ public static IConventionPropertyBuilder UseIdentityByDefaultColumn([NotNull] this IConventionPropertyBuilder propertyBuilder)
{
- if (propertyBuilder.ForNpgsqlCanSetValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityByDefaultColumn))
+ if (propertyBuilder.CanSetValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityByDefaultColumn))
{
var property = propertyBuilder.Metadata;
property.SetNpgsqlValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
@@ -319,9 +319,9 @@ public static IConventionPropertyBuilder ForNpgsqlUseIdentityByDefaultColumn([No
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseIdentityColumn(
+ public static PropertyBuilder UseIdentityColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityByDefaultColumn();
+ => propertyBuilder.UseIdentityByDefaultColumn();
///
///
@@ -335,9 +335,9 @@ public static PropertyBuilder ForNpgsqlUseIdentityColumn(
/// The type of the property being configured.
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- public static PropertyBuilder ForNpgsqlUseIdentityColumn(
+ public static PropertyBuilder UseIdentityColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityByDefaultColumn();
+ => propertyBuilder.UseIdentityByDefaultColumn();
#endregion Identity by default
@@ -352,7 +352,7 @@ public static PropertyBuilder ForNpgsqlUseIdentityColumn(
///
/// The same builder instance if the configuration was applied, null otherwise.
///
- public static IConventionPropertyBuilder ForNpgsqlHasValueGenerationStrategy(
+ public static IConventionPropertyBuilder HasValueGenerationStrategy(
[NotNull] this IConventionPropertyBuilder propertyBuilder,
NpgsqlValueGenerationStrategy? valueGenerationStrategy,
bool fromDataAnnotation = false)
@@ -363,7 +363,7 @@ public static IConventionPropertyBuilder ForNpgsqlHasValueGenerationStrategy(
propertyBuilder.Metadata.SetNpgsqlValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation);
if (valueGenerationStrategy != NpgsqlValueGenerationStrategy.SequenceHiLo)
{
- propertyBuilder.ForNpgsqlHasHiLoSequence(null, null, fromDataAnnotation);
+ propertyBuilder.HasHiLoSequence(null, null, fromDataAnnotation);
}
return propertyBuilder;
@@ -379,7 +379,7 @@ public static IConventionPropertyBuilder ForNpgsqlHasValueGenerationStrategy(
/// The value generation strategy.
/// Indicates whether the configuration was specified using a data annotation.
/// true if the given value can be set as the default value generation strategy.
- public static bool ForNpgsqlCanSetValueGenerationStrategy(
+ public static bool CanSetValueGenerationStrategy(
[NotNull] this IConventionPropertyBuilder propertyBuilder,
NpgsqlValueGenerationStrategy? valueGenerationStrategy,
bool fromDataAnnotation = false)
@@ -429,6 +429,30 @@ public static PropertyBuilder ForNpgsqlHasComment(
#region Obsolete
+ ///
+ /// Configures the property to use a sequence-based hi-lo pattern to generate values for new entities,
+ /// when targeting PostgreSQL. This method sets the property to be .
+ ///
+ /// The builder for the property being configured.
+ /// The comment of the sequence.
+ /// The schema of the sequence.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseHiLo")]
+ public static PropertyBuilder ForNpgsqlUseSequenceHiLo([NotNull] this PropertyBuilder propertyBuilder, [CanBeNull] string name = null, [CanBeNull] string schema = null)
+ => propertyBuilder.UseHiLo(name, schema);
+
+ ///
+ /// Configures the property to use a sequence-based hi-lo pattern to generate values for new entities,
+ /// when targeting PostgreSQL. This method sets the property to be .
+ ///
+ /// The builder for the property being configured.
+ /// The comment of the sequence.
+ /// The schema of the sequence.
+ /// The same builder instance so that multiple calls can be chained.
+ [Obsolete("Use UseHiLo")]
+ public static PropertyBuilder ForNpgsqlUseSequenceHiLo([NotNull] this PropertyBuilder propertyBuilder, [CanBeNull] string name = null, [CanBeNull] string schema = null)
+ => propertyBuilder.UseHiLo(name, schema);
+
///
/// Configures the property to use the PostgreSQL SERIAL feature to generate values for new entities,
/// when targeting PostgreSQL. This method sets the property to be .
@@ -436,9 +460,9 @@ public static PropertyBuilder ForNpgsqlHasComment(
/// The type of the property being configured.
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseSerialColumn instead")]
+ [Obsolete("Use UseSerialColumn")]
public static PropertyBuilder UseNpgsqlSerialColumn([NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseSerialColumn();
+ => propertyBuilder.UseSerialColumn();
///
/// Configures the property to use the PostgreSQL SERIAL feature to generate values for new entities,
@@ -447,10 +471,10 @@ public static PropertyBuilder UseNpgsqlSerialColumn([NotNull] this PropertyBuild
/// The type of the property being configured.
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseSerialColumn instead")]
+ [Obsolete("Use UseSerialColumn")]
public static PropertyBuilder UseNpgsqlSerialColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseSerialColumn();
+ => propertyBuilder.UseSerialColumn();
///
///
@@ -463,9 +487,9 @@ public static PropertyBuilder UseNpgsqlSerialColumn(
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseIdentityAlwaysColumn")]
+ [Obsolete("Use UseIdentityAlwaysColumn")]
public static PropertyBuilder UseNpgsqlIdentityAlwaysColumn([NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityAlwaysColumn();
+ => propertyBuilder.UseIdentityAlwaysColumn();
///
///
@@ -478,10 +502,10 @@ public static PropertyBuilder UseNpgsqlIdentityAlwaysColumn([NotNull] this Prope
///
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseIdentityAlwaysColumn")]
+ [Obsolete("Use UseIdentityAlwaysColumn")]
public static PropertyBuilder UseNpgsqlIdentityAlwaysColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityAlwaysColumn();
+ => propertyBuilder.UseIdentityAlwaysColumn();
///
///
@@ -494,9 +518,9 @@ public static PropertyBuilder UseNpgsqlIdentityAlwaysColumn
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseIdentityByDefaultColumn")]
+ [Obsolete("Use UseIdentityByDefaultColumn")]
public static PropertyBuilder UseNpgsqlIdentityByDefaultColumn([NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityByDefaultColumn();
+ => propertyBuilder.UseIdentityByDefaultColumn();
///
///
@@ -510,10 +534,10 @@ public static PropertyBuilder UseNpgsqlIdentityByDefaultColumn([NotNull] this Pr
/// The type of the property being configured.
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseIdentityByDefaultColumn")]
+ [Obsolete("Use UseIdentityByDefaultColumn")]
public static PropertyBuilder UseNpgsqlIdentityByDefaultColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityByDefaultColumn();
+ => propertyBuilder.UseIdentityByDefaultColumn();
///
///
@@ -526,10 +550,10 @@ public static PropertyBuilder UseNpgsqlIdentityByDefaultColumn
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseIdentityColumn")]
+ [Obsolete("Use UseIdentityColumn")]
public static PropertyBuilder UseNpgsqlIdentityColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityColumn();
+ => propertyBuilder.UseIdentityColumn();
///
///
@@ -543,10 +567,10 @@ public static PropertyBuilder UseNpgsqlIdentityColumn(
/// The type of the property being configured.
/// The builder for the property being configured.
/// The same builder instance so that multiple calls can be chained.
- [Obsolete("Use ForNpgsqlUseIdentityColumn")]
+ [Obsolete("Use UseIdentityColumn")]
public static PropertyBuilder UseNpgsqlIdentityColumn(
[NotNull] this PropertyBuilder propertyBuilder)
- => propertyBuilder.ForNpgsqlUseIdentityColumn();
+ => propertyBuilder.UseIdentityColumn();
#endregion Obsolete
}
diff --git a/src/EFCore.PG/Metadata/Conventions/NpgsqlStoreGenerationConvention.cs b/src/EFCore.PG/Metadata/Conventions/NpgsqlStoreGenerationConvention.cs
index ff5dfd16c..3d7962b6a 100644
--- a/src/EFCore.PG/Metadata/Conventions/NpgsqlStoreGenerationConvention.cs
+++ b/src/EFCore.PG/Metadata/Conventions/NpgsqlStoreGenerationConvention.cs
@@ -53,7 +53,7 @@ public override void ProcessPropertyAnnotationChanged(
switch (name)
{
case RelationalAnnotationNames.DefaultValue:
- if (propertyBuilder.ForNpgsqlHasValueGenerationStrategy(null, fromDataAnnotation) == null
+ if (propertyBuilder.HasValueGenerationStrategy(null, fromDataAnnotation) == null
&& propertyBuilder.HasDefaultValue(null, fromDataAnnotation) != null)
{
context.StopProcessing();
@@ -62,7 +62,7 @@ public override void ProcessPropertyAnnotationChanged(
break;
case RelationalAnnotationNames.DefaultValueSql:
- if (propertyBuilder.ForNpgsqlHasValueGenerationStrategy(null, fromDataAnnotation) == null
+ if (propertyBuilder.HasValueGenerationStrategy(null, fromDataAnnotation) == null
&& propertyBuilder.HasDefaultValueSql(null, fromDataAnnotation) != null)
{
context.StopProcessing();
@@ -71,7 +71,7 @@ public override void ProcessPropertyAnnotationChanged(
break;
case RelationalAnnotationNames.ComputedColumnSql:
- if (propertyBuilder.ForNpgsqlHasValueGenerationStrategy(null, fromDataAnnotation) == null
+ if (propertyBuilder.HasValueGenerationStrategy(null, fromDataAnnotation) == null
&& propertyBuilder.HasComputedColumnSql(null, fromDataAnnotation) != null)
{
context.StopProcessing();
@@ -83,7 +83,7 @@ public override void ProcessPropertyAnnotationChanged(
if ((propertyBuilder.HasDefaultValue(null, fromDataAnnotation) == null
| propertyBuilder.HasDefaultValueSql(null, fromDataAnnotation) == null
| propertyBuilder.HasComputedColumnSql(null, fromDataAnnotation) == null)
- && propertyBuilder.ForNpgsqlHasValueGenerationStrategy(null, fromDataAnnotation) != null)
+ && propertyBuilder.HasValueGenerationStrategy(null, fromDataAnnotation) != null)
{
context.StopProcessing();
return;
diff --git a/src/EFCore.PG/Metadata/Conventions/NpgsqlValueGenerationStrategyConvention.cs b/src/EFCore.PG/Metadata/Conventions/NpgsqlValueGenerationStrategyConvention.cs
index 6eadd30da..953f5edab 100644
--- a/src/EFCore.PG/Metadata/Conventions/NpgsqlValueGenerationStrategyConvention.cs
+++ b/src/EFCore.PG/Metadata/Conventions/NpgsqlValueGenerationStrategyConvention.cs
@@ -35,7 +35,7 @@ public NpgsqlValueGenerationStrategyConvention(
/// The builder for the model.
/// Additional information associated with convention execution.
public virtual void ProcessModelInitialized(IConventionModelBuilder modelBuilder, IConventionContext context)
- => modelBuilder.ForNpgsqlHasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SerialColumn);
+ => modelBuilder.HasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SerialColumn);
///
/// Called after a model is finalized.
@@ -53,7 +53,7 @@ public virtual void ProcessModelFinalized(
var strategy = property.GetNpgsqlValueGenerationStrategy();
if (strategy != NpgsqlValueGenerationStrategy.None)
{
- property.Builder.ForNpgsqlHasValueGenerationStrategy(strategy);
+ property.Builder.HasValueGenerationStrategy(strategy);
}
}
}
diff --git a/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs
index 79c20db80..fc728e197 100644
--- a/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs
+++ b/test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs
@@ -905,7 +905,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
((NpgsqlTypeMappingSource)context.GetService()).LoadUserDefinedTypeMappings(context.GetService());
modelBuilder.HasPostgresExtension("hstore");
- modelBuilder.ForNpgsqlHasEnum("mood", new[] { "happy", "sad" });
+ modelBuilder.HasPostgresEnum("mood", new[] { "happy", "sad" });
MakeRequired(modelBuilder);
diff --git a/test/EFCore.PG.FunctionalTests/F1NpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/F1NpgsqlFixture.cs
index 9ded27ffe..0207010df 100644
--- a/test/EFCore.PG.FunctionalTests/F1NpgsqlFixture.cs
+++ b/test/EFCore.PG.FunctionalTests/F1NpgsqlFixture.cs
@@ -17,9 +17,9 @@ protected override void BuildModelExternal(ModelBuilder modelBuilder)
{
base.BuildModelExternal(modelBuilder);
- modelBuilder.Entity().ForNpgsqlUseXminAsConcurrencyToken();
- modelBuilder.Entity().ForNpgsqlUseXminAsConcurrencyToken();
- modelBuilder.Entity().ForNpgsqlUseXminAsConcurrencyToken();
+ modelBuilder.Entity().UseXminAsConcurrencyToken();
+ modelBuilder.Entity().UseXminAsConcurrencyToken();
+ modelBuilder.Entity().UseXminAsConcurrencyToken();
}
}
}
diff --git a/test/EFCore.PG.FunctionalTests/MonsterFixupChangedChangingNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/MonsterFixupChangedChangingNpgsqlTest.cs
index 57c9f9140..0be411935 100644
--- a/test/EFCore.PG.FunctionalTests/MonsterFixupChangedChangingNpgsqlTest.cs
+++ b/test/EFCore.PG.FunctionalTests/MonsterFixupChangedChangingNpgsqlTest.cs
@@ -21,9 +21,9 @@ protected override void OnModelCreating(builder);
- builder.Entity().Property(e => e.MessageId).ForNpgsqlUseSerialColumn();
- builder.Entity().Property(e => e.PhotoId).ForNpgsqlUseSerialColumn();
- builder.Entity().Property(e => e.ReviewId).ForNpgsqlUseSerialColumn();
+ builder.Entity().Property(e => e.MessageId).UseSerialColumn();
+ builder.Entity().Property(e => e.PhotoId).UseSerialColumn();
+ builder.Entity().Property(e => e.ReviewId).UseSerialColumn();
}
}
}
diff --git a/test/EFCore.PG.FunctionalTests/NpgsqlValueGenerationScenariosTest.cs b/test/EFCore.PG.FunctionalTests/NpgsqlValueGenerationScenariosTest.cs
index 484f9016c..75719b719 100644
--- a/test/EFCore.PG.FunctionalTests/NpgsqlValueGenerationScenariosTest.cs
+++ b/test/EFCore.PG.FunctionalTests/NpgsqlValueGenerationScenariosTest.cs
@@ -73,7 +73,7 @@ public BlogContextHiLo(string databaseName)
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
- => modelBuilder.ForNpgsqlUseSequenceHiLo();
+ => modelBuilder.UseHiLo();
}
[Fact]
diff --git a/test/EFCore.PG.FunctionalTests/ProxyGraphUpdatesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/ProxyGraphUpdatesNpgsqlTest.cs
index c4b4b0bf1..7475e51a5 100644
--- a/test/EFCore.PG.FunctionalTests/ProxyGraphUpdatesNpgsqlTest.cs
+++ b/test/EFCore.PG.FunctionalTests/ProxyGraphUpdatesNpgsqlTest.cs
@@ -49,7 +49,7 @@ protected override IServiceCollection AddServices(IServiceCollection serviceColl
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
if (TestEnvironment.PostgresVersion >= new Version(10, 0))
- modelBuilder.ForNpgsqlUseIdentityColumns();
+ modelBuilder.UseIdentityColumns();
base.OnModelCreating(modelBuilder, context);
}
diff --git a/test/EFCore.PG.FunctionalTests/Query/EnumQueryTest.cs b/test/EFCore.PG.FunctionalTests/Query/EnumQueryTest.cs
index a7a71a43d..d9032bc63 100644
--- a/test/EFCore.PG.FunctionalTests/Query/EnumQueryTest.cs
+++ b/test/EFCore.PG.FunctionalTests/Query/EnumQueryTest.cs
@@ -165,10 +165,10 @@ static EnumContext()
public EnumContext(DbContextOptions options) : base(options) {}
protected override void OnModelCreating(ModelBuilder builder)
- => builder.ForNpgsqlHasEnum("mapped_enum", new[] { "happy", "sad" })
- .ForNpgsqlHasEnum()
+ => builder.HasPostgresEnum("mapped_enum", new[] { "happy", "sad" })
+ .HasPostgresEnum()
.HasDefaultSchema("test")
- .ForNpgsqlHasEnum();
+ .HasPostgresEnum();
public static void Seed(EnumContext context)
{
diff --git a/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs
index 9f0adb1fe..ba9a3fa8e 100644
--- a/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs
+++ b/test/EFCore.PG.FunctionalTests/Query/RangeQueryNpgsqlTest.cs
@@ -599,8 +599,8 @@ public RangeContext(DbContextOptions options) : base(options) {}
///
protected override void OnModelCreating(ModelBuilder builder)
- => builder.ForNpgsqlHasRange("floatrange", "real")
- .ForNpgsqlHasRange("test", "Schema_Range", "double precision");
+ => builder.HasPostgresRange("floatrange", "real")
+ .HasPostgresRange("test", "Schema_Range", "double precision");
public static void Seed(RangeContext context)
{
diff --git a/test/EFCore.PG.FunctionalTests/StoreGeneratedNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/StoreGeneratedNpgsqlTest.cs
index 4b8c36864..eeb943648 100644
--- a/test/EFCore.PG.FunctionalTests/StoreGeneratedNpgsqlTest.cs
+++ b/test/EFCore.PG.FunctionalTests/StoreGeneratedNpgsqlTest.cs
@@ -27,7 +27,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
modelBuilder.Entity(
b =>
{
- b.Property(e => e.Id).ForNpgsqlUseSerialColumn();
+ b.Property(e => e.Id).UseSerialColumn();
b.Property(e => e.Identity).HasDefaultValue("Banana Joe");
b.Property(e => e.IdentityReadOnlyBeforeSave).HasDefaultValue("Doughnut Sheriff");
b.Property(e => e.IdentityReadOnlyAfterSave).HasDefaultValue("Anton");
diff --git a/test/EFCore.PG.Tests/Design/Internal/NpgsqlAnnotationCodeGeneratorTest.cs b/test/EFCore.PG.Tests/Design/Internal/NpgsqlAnnotationCodeGeneratorTest.cs
index 04dfc55a0..0e8f3672d 100644
--- a/test/EFCore.PG.Tests/Design/Internal/NpgsqlAnnotationCodeGeneratorTest.cs
+++ b/test/EFCore.PG.Tests/Design/Internal/NpgsqlAnnotationCodeGeneratorTest.cs
@@ -18,14 +18,14 @@ public void GenerateFluentApi_identity()
"Post",
x =>
{
- x.Property("Id").ForNpgsqlUseIdentityAlwaysColumn();
+ x.Property("Id").UseIdentityAlwaysColumn();
});
var property = modelBuilder.Model.FindEntityType("Post").GetProperties().Single();
var annotation = property.FindAnnotation(NpgsqlAnnotationNames.ValueGenerationStrategy);
var result = generator.GenerateFluentApi(property, annotation);
- Assert.Equal("ForNpgsqlUseIdentityAlwaysColumn", result.Method);
+ Assert.Equal("UseIdentityAlwaysColumn", result.Method);
Assert.Equal(0, result.Arguments.Count);
}
diff --git a/test/EFCore.PG.Tests/Metadata/Conventions/NpgsqlValueGenerationStrategyConventionTest.cs b/test/EFCore.PG.Tests/Metadata/Conventions/NpgsqlValueGenerationStrategyConventionTest.cs
index 40572c593..3ff71cb6c 100644
--- a/test/EFCore.PG.Tests/Metadata/Conventions/NpgsqlValueGenerationStrategyConventionTest.cs
+++ b/test/EFCore.PG.Tests/Metadata/Conventions/NpgsqlValueGenerationStrategyConventionTest.cs
@@ -27,7 +27,7 @@ public void Annotations_are_added_when_conventional_model_builder_is_used()
public void Annotations_are_added_when_conventional_model_builder_is_used_with_sequences()
{
var model = NpgsqlTestHelpers.Instance.CreateConventionBuilder()
- .ForNpgsqlUseSequenceHiLo()
+ .UseHiLo()
.Model;
model.RemoveAnnotation(CoreAnnotationNames.ProductVersion);
diff --git a/test/EFCore.PG.Tests/Metadata/NpgsqlBuilderExtensionsTest.cs b/test/EFCore.PG.Tests/Metadata/NpgsqlBuilderExtensionsTest.cs
index 6c30f6d66..fd8cec232 100644
--- a/test/EFCore.PG.Tests/Metadata/NpgsqlBuilderExtensionsTest.cs
+++ b/test/EFCore.PG.Tests/Metadata/NpgsqlBuilderExtensionsTest.cs
@@ -15,7 +15,7 @@ public void CockroachDbInterleaveInParent()
modelBuilder.Entity()
.ToTable("customers", "my_schema")
- .ForCockroachDbInterleaveInParent(typeof(Customer), new List { "col_a", "col_b" });
+ .UseCockroachDbInterleaveInParent(typeof(Customer), new List { "col_a", "col_b" });
var entityType = modelBuilder.Model.FindEntityType(typeof(Customer));
var interleaveInParent = entityType.GetNpgsqlCockroachDbInterleaveInParent();
diff --git a/test/EFCore.PG.Tests/Metadata/NpgsqlMetadataBuilderExtensionsTest.cs b/test/EFCore.PG.Tests/Metadata/NpgsqlMetadataBuilderExtensionsTest.cs
index ec99cad02..49585e69d 100644
--- a/test/EFCore.PG.Tests/Metadata/NpgsqlMetadataBuilderExtensionsTest.cs
+++ b/test/EFCore.PG.Tests/Metadata/NpgsqlMetadataBuilderExtensionsTest.cs
@@ -22,16 +22,16 @@ public void Can_access_model()
var builder = CreateBuilder();
Assert.NotNull(builder
- .ForNpgsqlHasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SequenceHiLo));
+ .HasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SequenceHiLo));
Assert.Equal(NpgsqlValueGenerationStrategy.SequenceHiLo, builder.Metadata.GetNpgsqlValueGenerationStrategy());
Assert.NotNull(builder
- .ForNpgsqlHasValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityByDefaultColumn, fromDataAnnotation: true));
+ .HasValueGenerationStrategy(NpgsqlValueGenerationStrategy.IdentityByDefaultColumn, fromDataAnnotation: true));
Assert.Equal(
NpgsqlValueGenerationStrategy.IdentityByDefaultColumn, builder.Metadata.GetNpgsqlValueGenerationStrategy());
Assert.Null(builder
- .ForNpgsqlHasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SequenceHiLo));
+ .HasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SequenceHiLo));
Assert.Equal(NpgsqlValueGenerationStrategy.IdentityByDefaultColumn, builder.Metadata.GetNpgsqlValueGenerationStrategy());
Assert.Equal(
@@ -44,13 +44,13 @@ public void Can_access_entity_type()
{
var typeBuilder = CreateBuilder().Entity(typeof(Splot));
- Assert.NotNull(typeBuilder.ForNpgsqlIsUnlogged());
+ Assert.NotNull(typeBuilder.IsUnlogged());
Assert.True(typeBuilder.Metadata.GetNpgsqlIsUnlogged());
- Assert.NotNull(typeBuilder.ForNpgsqlIsUnlogged(false, fromDataAnnotation: true));
+ Assert.NotNull(typeBuilder.IsUnlogged(false, fromDataAnnotation: true));
Assert.False(typeBuilder.Metadata.GetNpgsqlIsUnlogged());
- Assert.Null(typeBuilder.ForNpgsqlIsUnlogged(true));
+ Assert.Null(typeBuilder.IsUnlogged(true));
Assert.False(typeBuilder.Metadata.GetNpgsqlIsUnlogged());
Assert.Equal(
@@ -65,13 +65,13 @@ public void Can_access_property()
.Entity(typeof(Splot))
.Property(typeof(int), "Id");
- Assert.NotNull(propertyBuilder.ForNpgsqlHasHiLoSequence("Splew", null));
+ Assert.NotNull(propertyBuilder.HasHiLoSequence("Splew", null));
Assert.Equal("Splew", propertyBuilder.Metadata.GetNpgsqlHiLoSequenceName());
- Assert.NotNull(propertyBuilder.ForNpgsqlHasHiLoSequence("Splow", null, fromDataAnnotation: true));
+ Assert.NotNull(propertyBuilder.HasHiLoSequence("Splow", null, fromDataAnnotation: true));
Assert.Equal("Splow", propertyBuilder.Metadata.GetNpgsqlHiLoSequenceName());
- Assert.Null(propertyBuilder.ForNpgsqlHasHiLoSequence("Splod", null));
+ Assert.Null(propertyBuilder.HasHiLoSequence("Splod", null));
Assert.Equal("Splow", propertyBuilder.Metadata.GetNpgsqlHiLoSequenceName());
Assert.Equal(
@@ -89,12 +89,12 @@ public void Throws_setting_sequence_generation_for_invalid_type()
Assert.Equal(
NpgsqlStrings.SequenceBadType("Name", nameof(Splot), "string"),
Assert.Throws(
- () => propertyBuilder.ForNpgsqlHasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SequenceHiLo)).Message);
+ () => propertyBuilder.HasValueGenerationStrategy(NpgsqlValueGenerationStrategy.SequenceHiLo)).Message);
Assert.Equal(
NpgsqlStrings.SequenceBadType("Name", nameof(Splot), "string"),
Assert.Throws(
- () => new PropertyBuilder((IMutableProperty)propertyBuilder.Metadata).ForNpgsqlUseSequenceHiLo()).Message);
+ () => new PropertyBuilder((IMutableProperty)propertyBuilder.Metadata).UseHiLo()).Message);
}
[ConditionalFact]
@@ -105,13 +105,13 @@ public void Can_access_index()
var idProperty = entityTypeBuilder.Property(typeof(int), "Id").Metadata;
var indexBuilder = entityTypeBuilder.HasIndex(new[] { idProperty });
- Assert.NotNull(indexBuilder.ForNpgsqlHasMethod("gin"));
+ Assert.NotNull(indexBuilder.HasMethod("gin"));
Assert.Equal("gin", indexBuilder.Metadata.GetNpgsqlMethod());
- Assert.NotNull(indexBuilder.ForNpgsqlHasMethod("gist", fromDataAnnotation: true));
+ Assert.NotNull(indexBuilder.HasMethod("gist", fromDataAnnotation: true));
Assert.Equal("gist", indexBuilder.Metadata.GetNpgsqlMethod());
- Assert.Null(indexBuilder.ForNpgsqlHasMethod("gin"));
+ Assert.Null(indexBuilder.HasMethod("gin"));
Assert.Equal("gist", indexBuilder.Metadata.GetNpgsqlMethod());
Assert.Equal(
diff --git a/test/EFCore.PG.Tests/NpgsqlValueGeneratorSelectorTest.cs b/test/EFCore.PG.Tests/NpgsqlValueGeneratorSelectorTest.cs
index d71c71dce..7a923fd0b 100644
--- a/test/EFCore.PG.Tests/NpgsqlValueGeneratorSelectorTest.cs
+++ b/test/EFCore.PG.Tests/NpgsqlValueGeneratorSelectorTest.cs
@@ -48,7 +48,7 @@ void AssertGenerator(string propertyName, bool setSequences = false)
if (setSequences)
{
- builder.ForNpgsqlUseSequenceHiLo();
+ builder.UseHiLo();
Assert.NotNull(builder.Model.FindSequence(NpgsqlModelExtensions.DefaultHiLoSequenceName));
}
@@ -162,10 +162,10 @@ public void Returns_generator_configured_on_model_when_property_is_identity()
builder.Entity();
builder
- .ForNpgsqlUseSequenceHiLo()
+ .UseHiLo()
.HasSequence(NpgsqlModelExtensions.DefaultHiLoSequenceName);
- var model = builder.ForNpgsqlUseSequenceHiLo().FinalizeModel();
+ var model = builder.UseHiLo().FinalizeModel();
var entityType = model.FindEntityType(typeof(AnEntity));
var selector = NpgsqlTestHelpers.Instance.CreateContextServices(model).GetRequiredService();