Skip to content

Commit

Permalink
Rename provider specific core metadata extensions
Browse files Browse the repository at this point in the history
Fixes #16773

Note going through obsolete here since this are a lot less used.
  • Loading branch information
ajcvickers committed Jul 29, 2019
1 parent c2a39d7 commit 714e6ba
Show file tree
Hide file tree
Showing 34 changed files with 361 additions and 361 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static EntityTypeBuilder IsMemoryOptimized(
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));

entityTypeBuilder.Metadata.SetSqlServerIsMemoryOptimized(memoryOptimized);
entityTypeBuilder.Metadata.SetIsMemoryOptimized(memoryOptimized);

return entityTypeBuilder;
}
Expand Down Expand Up @@ -54,7 +54,7 @@ public static OwnedNavigationBuilder IsMemoryOptimized(
{
Check.NotNull(collectionOwnershipBuilder, nameof(collectionOwnershipBuilder));

collectionOwnershipBuilder.OwnedEntityType.SetSqlServerIsMemoryOptimized(memoryOptimized);
collectionOwnershipBuilder.OwnedEntityType.SetIsMemoryOptimized(memoryOptimized);

return collectionOwnershipBuilder;
}
Expand Down Expand Up @@ -91,7 +91,7 @@ public static IConventionEntityTypeBuilder IsMemoryOptimized(
{
if (entityTypeBuilder.CanSetIsMemoryOptimized(memoryOptimized, fromDataAnnotation))
{
entityTypeBuilder.Metadata.SetSqlServerIsMemoryOptimized(memoryOptimized, fromDataAnnotation);
entityTypeBuilder.Metadata.SetIsMemoryOptimized(memoryOptimized, fromDataAnnotation);
return entityTypeBuilder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public static class SqlServerEntityTypeExtensions
/// </summary>
/// <param name="entityType"> The entity type. </param>
/// <returns> <c>true</c> if the entity type is mapped to a memory-optimized table. </returns>
public static bool GetSqlServerIsMemoryOptimized([NotNull] this IEntityType entityType)
public static bool IsMemoryOptimized([NotNull] this IEntityType entityType)
=> entityType[SqlServerAnnotationNames.MemoryOptimized] as bool? ?? false;

/// <summary>
/// Sets a value indicating whether the entity type is mapped to a memory-optimized table.
/// </summary>
/// <param name="entityType"> The entity type. </param>
/// <param name="memoryOptimized"> The value to set. </param>
public static void SetSqlServerIsMemoryOptimized([NotNull] this IMutableEntityType entityType, bool memoryOptimized)
public static void SetIsMemoryOptimized([NotNull] this IMutableEntityType entityType, bool memoryOptimized)
=> entityType.SetOrRemoveAnnotation(SqlServerAnnotationNames.MemoryOptimized, memoryOptimized);

/// <summary>
Expand All @@ -35,7 +35,7 @@ public static void SetSqlServerIsMemoryOptimized([NotNull] this IMutableEntityTy
/// <param name="entityType"> The entity type. </param>
/// <param name="memoryOptimized"> The value to set. </param>
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
public static void SetSqlServerIsMemoryOptimized(
public static void SetIsMemoryOptimized(
[NotNull] this IConventionEntityType entityType, bool? memoryOptimized, bool fromDataAnnotation = false)
=> entityType.SetOrRemoveAnnotation(SqlServerAnnotationNames.MemoryOptimized, memoryOptimized, fromDataAnnotation);

Expand All @@ -44,7 +44,7 @@ public static void SetSqlServerIsMemoryOptimized(
/// </summary>
/// <param name="entityType"> The entity type. </param>
/// <returns> The configuration source for the memory-optimized setting. </returns>
public static ConfigurationSource? GetSqlServerIsMemoryOptimizedConfigurationSource([NotNull] this IConventionEntityType entityType)
public static ConfigurationSource? GetIsMemoryOptimizedConfigurationSource([NotNull] this IConventionEntityType entityType)
=> entityType.FindAnnotation(SqlServerAnnotationNames.MemoryOptimized)?.GetConfigurationSource();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static IndexBuilder IsClustered([NotNull] this IndexBuilder indexBuilder,
{
Check.NotNull(indexBuilder, nameof(indexBuilder));

indexBuilder.Metadata.SetSqlServerIsClustered(clustered);
indexBuilder.Metadata.SetIsClustered(clustered);

return indexBuilder;
}
Expand Down Expand Up @@ -64,7 +64,7 @@ public static IConventionIndexBuilder IsClustered(
{
if (indexBuilder.CanSetIsClustered(clustered, fromDataAnnotation))
{
indexBuilder.Metadata.SetSqlServerIsClustered(clustered, fromDataAnnotation);
indexBuilder.Metadata.SetIsClustered(clustered, fromDataAnnotation);
return indexBuilder;
}

Expand Down Expand Up @@ -99,7 +99,7 @@ public static IndexBuilder IncludeProperties([NotNull] this IndexBuilder indexBu
Check.NotNull(indexBuilder, nameof(indexBuilder));
Check.NotNull(propertyNames, nameof(propertyNames));

indexBuilder.Metadata.SetSqlServerIncludeProperties(propertyNames);
indexBuilder.Metadata.SetIncludeProperties(propertyNames);

return indexBuilder;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ public static IConventionIndexBuilder IncludeProperties(
{
if (indexBuilder.CanSetIncludeProperties(propertyNames, fromDataAnnotation))
{
indexBuilder.Metadata.SetSqlServerIncludeProperties(propertyNames, fromDataAnnotation);
indexBuilder.Metadata.SetIncludeProperties(propertyNames, fromDataAnnotation);

return indexBuilder;
}
Expand All @@ -172,9 +172,9 @@ public static bool CanSetIncludeProperties(
Check.NotNull(indexBuilder, nameof(indexBuilder));

return (fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention)
.Overrides(indexBuilder.Metadata.GetSqlServerIncludePropertiesConfigurationSource())
.Overrides(indexBuilder.Metadata.GetIncludePropertiesConfigurationSource())
|| StructuralComparisons.StructuralEqualityComparer.Equals(
propertyNames, indexBuilder.Metadata.GetSqlServerIncludeProperties());
propertyNames, indexBuilder.Metadata.GetIncludeProperties());
}

/// <summary>
Expand All @@ -187,7 +187,7 @@ public static IndexBuilder IsCreatedOnline([NotNull] this IndexBuilder indexBuil
{
Check.NotNull(indexBuilder, nameof(indexBuilder));

indexBuilder.Metadata.SetSqlServerIsCreatedOnline(createdOnline);
indexBuilder.Metadata.SetIsCreatedOnline(createdOnline);

return indexBuilder;
}
Expand Down Expand Up @@ -219,7 +219,7 @@ public static IConventionIndexBuilder IsCreatedOnline(
{
if (indexBuilder.CanSetIsCreatedOnline(createdOnline, fromDataAnnotation))
{
indexBuilder.Metadata.SetSqlServerIsCreatedOnline(createdOnline, fromDataAnnotation);
indexBuilder.Metadata.SetIsCreatedOnline(createdOnline, fromDataAnnotation);

return indexBuilder;
}
Expand Down
24 changes: 12 additions & 12 deletions src/EFCore.SqlServer/Extensions/SqlServerIndexExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public static class SqlServerIndexExtensions
/// </summary>
/// <param name="index"> The index. </param>
/// <returns> <c>true</c> if the index is clustered. </returns>
public static bool? GetSqlServerIsClustered([NotNull] this IIndex index)
public static bool? IsClustered([NotNull] this IIndex index)
=> (bool?)index[SqlServerAnnotationNames.Clustered];

/// <summary>
/// Sets a value indicating whether the index is clustered.
/// </summary>
/// <param name="value"> The value to set. </param>
/// <param name="index"> The index. </param>
public static void SetSqlServerIsClustered([NotNull] this IMutableIndex index, bool? value)
public static void SetIsClustered([NotNull] this IMutableIndex index, bool? value)
=> index.SetOrRemoveAnnotation(
SqlServerAnnotationNames.Clustered,
value);
Expand All @@ -38,7 +38,7 @@ public static void SetSqlServerIsClustered([NotNull] this IMutableIndex index, b
/// <param name="value"> The value to set. </param>
/// <param name="index"> The index. </param>
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
public static void SetSqlServerIsClustered(
public static void SetIsClustered(
[NotNull] this IConventionIndex index, bool? value, bool fromDataAnnotation = false)
=> index.SetOrRemoveAnnotation(
SqlServerAnnotationNames.Clustered,
Expand All @@ -50,23 +50,23 @@ public static void SetSqlServerIsClustered(
/// </summary>
/// <param name="property"> The property. </param>
/// <returns> The <see cref="ConfigurationSource" /> for whether the index is clustered. </returns>
public static ConfigurationSource? GetSqlServerIsClusteredConfigurationSource([NotNull] this IConventionIndex property)
public static ConfigurationSource? GetIsClusteredConfigurationSource([NotNull] this IConventionIndex property)
=> property.FindAnnotation(SqlServerAnnotationNames.Clustered)?.GetConfigurationSource();

/// <summary>
/// Returns included property names, or <c>null</c> if they have not been specified.
/// </summary>
/// <param name="index"> The index. </param>
/// <returns> The included property names, or <c>null</c> if they have not been specified. </returns>
public static IReadOnlyList<string> GetSqlServerIncludeProperties([NotNull] this IIndex index)
public static IReadOnlyList<string> GetIncludeProperties([NotNull] this IIndex index)
=> (string[])index[SqlServerAnnotationNames.Include];

/// <summary>
/// Sets included property names.
/// </summary>
/// <param name="index"> The index. </param>
/// <param name="properties"> The value to set. </param>
public static void SetSqlServerIncludeProperties([NotNull] this IMutableIndex index, [NotNull] IReadOnlyList<string> properties)
public static void SetIncludeProperties([NotNull] this IMutableIndex index, [NotNull] IReadOnlyList<string> properties)
=> index.SetOrRemoveAnnotation(
SqlServerAnnotationNames.Include,
properties);
Expand All @@ -77,7 +77,7 @@ public static void SetSqlServerIncludeProperties([NotNull] this IMutableIndex in
/// <param name="index"> The index. </param>
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
/// <param name="properties"> The value to set. </param>
public static void SetSqlServerIncludeProperties(
public static void SetIncludeProperties(
[NotNull] this IConventionIndex index, [NotNull] IReadOnlyList<string> properties, bool fromDataAnnotation = false)
=> index.SetOrRemoveAnnotation(
SqlServerAnnotationNames.Include,
Expand All @@ -89,23 +89,23 @@ public static void SetSqlServerIncludeProperties(
/// </summary>
/// <param name="index"> The index. </param>
/// <returns> The <see cref="ConfigurationSource" /> for the included property names. </returns>
public static ConfigurationSource? GetSqlServerIncludePropertiesConfigurationSource([NotNull] this IConventionIndex index)
public static ConfigurationSource? GetIncludePropertiesConfigurationSource([NotNull] this IConventionIndex index)
=> index.FindAnnotation(SqlServerAnnotationNames.Include)?.GetConfigurationSource();

/// <summary>
/// Returns a value indicating whether the index is online.
/// </summary>
/// <param name="index"> The index. </param>
/// <returns> <c>true</c> if the index is online. </returns>
public static bool? GetSqlServerIsCreatedOnline([NotNull] this IIndex index)
public static bool? IsCreatedOnline([NotNull] this IIndex index)
=> (bool?)index[SqlServerAnnotationNames.CreatedOnline];

/// <summary>
/// Sets a value indicating whether the index is online.
/// </summary>
/// <param name="index"> The index. </param>
/// <param name="createdOnline"> The value to set. </param>
public static void SetSqlServerIsCreatedOnline([NotNull] this IMutableIndex index, bool? createdOnline)
public static void SetIsCreatedOnline([NotNull] this IMutableIndex index, bool? createdOnline)
=> index.SetOrRemoveAnnotation(
SqlServerAnnotationNames.CreatedOnline,
createdOnline);
Expand All @@ -116,7 +116,7 @@ public static void SetSqlServerIsCreatedOnline([NotNull] this IMutableIndex inde
/// <param name="index"> The index. </param>
/// <param name="createdOnline"> The value to set. </param>
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
public static void SetSqlServerIsCreatedOnline(
public static void SetIsCreatedOnline(
[NotNull] this IConventionIndex index, bool? createdOnline, bool fromDataAnnotation = false)
=> index.SetOrRemoveAnnotation(
SqlServerAnnotationNames.CreatedOnline,
Expand All @@ -128,7 +128,7 @@ public static void SetSqlServerIsCreatedOnline(
/// </summary>
/// <param name="index"> The index. </param>
/// <returns> The <see cref="ConfigurationSource" /> for whether the index is online. </returns>
public static ConfigurationSource? GetSqlServerIsCreatedOnlineConfigurationSource([NotNull] this IConventionIndex index)
public static ConfigurationSource? GetIsCreatedOnlineConfigurationSource([NotNull] this IConventionIndex index)
=> index.FindAnnotation(SqlServerAnnotationNames.CreatedOnline)?.GetConfigurationSource();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static KeyBuilder IsClustered([NotNull] this KeyBuilder keyBuilder, bool
{
Check.NotNull(keyBuilder, nameof(keyBuilder));

keyBuilder.Metadata.SetSqlServerIsClustered(clustered);
keyBuilder.Metadata.SetIsClustered(clustered);

return keyBuilder;
}
Expand All @@ -47,7 +47,7 @@ public static IConventionKeyBuilder IsClustered(
{
if (keyBuilder.CanSetIsClustered(clustered, fromDataAnnotation))
{
keyBuilder.Metadata.SetSqlServerIsClustered(clustered, fromDataAnnotation);
keyBuilder.Metadata.SetIsClustered(clustered, fromDataAnnotation);
return keyBuilder;
}

Expand Down
10 changes: 5 additions & 5 deletions src/EFCore.SqlServer/Extensions/SqlServerKeyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ public static class SqlServerKeyExtensions
/// </summary>
/// <param name="key"> The key. </param>
/// <returns> <c>true</c> if the key is clustered. </returns>
public static bool? GetSqlServerIsClustered([NotNull] this IKey key)
public static bool? IsClustered([NotNull] this IKey key)
=> (bool?)key[SqlServerAnnotationNames.Clustered] ?? GetDefaultIsClustered(key);

private static bool? GetDefaultIsClustered(IKey key)
{
var sharedTablePrincipalPrimaryKeyProperty = key.Properties[0].FindSharedTableRootPrimaryKeyProperty();
return sharedTablePrincipalPrimaryKeyProperty?.FindContainingPrimaryKey().GetSqlServerIsClustered();
return sharedTablePrincipalPrimaryKeyProperty?.FindContainingPrimaryKey().IsClustered();
}

/// <summary>
/// Sets a value indicating whether the key is clustered.
/// </summary>
/// <param name="key"> The key. </param>
/// <param name="clustered"> The value to set. </param>
public static void SetSqlServerIsClustered([NotNull] this IMutableKey key, bool? clustered)
public static void SetIsClustered([NotNull] this IMutableKey key, bool? clustered)
=> key.SetOrRemoveAnnotation(SqlServerAnnotationNames.Clustered, clustered);

/// <summary>
Expand All @@ -41,15 +41,15 @@ public static void SetSqlServerIsClustered([NotNull] this IMutableKey key, bool?
/// <param name="key"> The key. </param>
/// <param name="clustered"> The value to set. </param>
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
public static void SetSqlServerIsClustered([NotNull] this IConventionKey key, bool? clustered, bool fromDataAnnotation = false)
public static void SetIsClustered([NotNull] this IConventionKey key, bool? clustered, bool fromDataAnnotation = false)
=> key.SetOrRemoveAnnotation(SqlServerAnnotationNames.Clustered, clustered, fromDataAnnotation);

/// <summary>
/// Gets the <see cref="ConfigurationSource" /> for whether the key is clustered.
/// </summary>
/// <param name="key"> The key. </param>
/// <returns> The <see cref="ConfigurationSource" /> for whether the key is clustered. </returns>
public static ConfigurationSource? GetSqlServerIsClusteredConfigurationSource([NotNull] this IConventionKey key)
public static ConfigurationSource? GetIsClusteredConfigurationSource([NotNull] this IConventionKey key)
=> key.FindAnnotation(SqlServerAnnotationNames.Clustered)?.GetConfigurationSource();
}
}
Loading

0 comments on commit 714e6ba

Please sign in to comment.