From 1d7548e3d7f56fffc8644e111d1913e317dbb1d6 Mon Sep 17 00:00:00 2001 From: Arthur Vickers Date: Mon, 29 Jul 2019 12:18:37 -0700 Subject: [PATCH] Rename provider specific core metadata extensions Fixes #16773 Note going through obsolete here since this are a lot less used. --- .../SqlServerEntityTypeBuilderExtensions.cs | 6 +- .../SqlServerEntityTypeExtensions.cs | 8 +- .../SqlServerIndexBuilderExtensions.cs | 16 +- .../Extensions/SqlServerIndexExtensions.cs | 24 +-- .../SqlServerKeyBuilderExtensions.cs | 4 +- .../Extensions/SqlServerKeyExtensions.cs | 10 +- .../SqlServerModelBuilderExtensions.cs | 30 +-- .../Extensions/SqlServerModelExtensions.cs | 40 ++-- .../SqlServerPropertyBuilderExtensions.cs | 30 +-- .../Extensions/SqlServerPropertyExtensions.cs | 62 +++--- .../Internal/SqlServerModelValidator.cs | 22 +-- .../Conventions/SqlServerIndexConvention.cs | 2 +- ...qlServerMemoryOptimizedTablesConvention.cs | 4 +- .../SqlServerStoreGenerationConvention.cs | 4 +- .../SqlServerValueGenerationConvention.cs | 2 +- ...ServerValueGenerationStrategyConvention.cs | 2 +- .../SqlServerMigrationsAnnotationProvider.cs | 18 +- .../SqlServerMigrationsSqlGenerator.cs | 4 +- .../Internal/SqlServerUpdateSqlGenerator.cs | 6 +- .../Internal/SqlServerValueGeneratorCache.cs | 2 +- .../SqlServerValueGeneratorSelector.cs | 2 +- .../SqlitePropertyBuilderExtensions.cs | 6 +- .../Extensions/SqlitePropertyExtensions.cs | 16 +- .../SqliteMigrationsAnnotationProvider.cs | 4 +- ...tTopologySuitePropertyBuilderExtensions.cs | 2 +- .../DataAnnotationSqlServerTest.cs | 8 +- .../SqlServerModelValidatorTest.cs | 2 +- ...rverMemoryOptimizedTablesConventionTest.cs | 12 +- .../SqlServerBuilderExtensionsTest.cs | 134 ++++++------- .../SqlServerMetadataBuilderExtensionsTest.cs | 30 +-- .../SqlServerMetadataExtensionsTest.cs | 176 +++++++++--------- .../SqlServerModelBuilderGenericTest.cs | 6 +- .../Builders/SqliteBuilderExtensionsTest.cs | 8 +- .../Metadata/SqliteMetadataExtensionsTest.cs | 20 +- 34 files changed, 361 insertions(+), 361 deletions(-) diff --git a/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeBuilderExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeBuilderExtensions.cs index fcd9a903b7c..b31dc710922 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeBuilderExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeBuilderExtensions.cs @@ -26,7 +26,7 @@ public static EntityTypeBuilder IsMemoryOptimized( { Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder)); - entityTypeBuilder.Metadata.SetSqlServerIsMemoryOptimized(memoryOptimized); + entityTypeBuilder.Metadata.SetIsMemoryOptimized(memoryOptimized); return entityTypeBuilder; } @@ -54,7 +54,7 @@ public static OwnedNavigationBuilder IsMemoryOptimized( { Check.NotNull(collectionOwnershipBuilder, nameof(collectionOwnershipBuilder)); - collectionOwnershipBuilder.OwnedEntityType.SetSqlServerIsMemoryOptimized(memoryOptimized); + collectionOwnershipBuilder.OwnedEntityType.SetIsMemoryOptimized(memoryOptimized); return collectionOwnershipBuilder; } @@ -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; } diff --git a/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeExtensions.cs index b1031f249c6..bffda4568a8 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerEntityTypeExtensions.cs @@ -18,7 +18,7 @@ public static class SqlServerEntityTypeExtensions /// /// The entity type. /// true if the entity type is mapped to a memory-optimized table. - public static bool GetSqlServerIsMemoryOptimized([NotNull] this IEntityType entityType) + public static bool IsMemoryOptimized([NotNull] this IEntityType entityType) => entityType[SqlServerAnnotationNames.MemoryOptimized] as bool? ?? false; /// @@ -26,7 +26,7 @@ public static bool GetSqlServerIsMemoryOptimized([NotNull] this IEntityType enti /// /// The entity type. /// The value to set. - 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); /// @@ -35,7 +35,7 @@ public static void SetSqlServerIsMemoryOptimized([NotNull] this IMutableEntityTy /// The entity type. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerIsMemoryOptimized( + public static void SetIsMemoryOptimized( [NotNull] this IConventionEntityType entityType, bool? memoryOptimized, bool fromDataAnnotation = false) => entityType.SetOrRemoveAnnotation(SqlServerAnnotationNames.MemoryOptimized, memoryOptimized, fromDataAnnotation); @@ -44,7 +44,7 @@ public static void SetSqlServerIsMemoryOptimized( /// /// The entity type. /// The configuration source for the memory-optimized setting. - public static ConfigurationSource? GetSqlServerIsMemoryOptimizedConfigurationSource([NotNull] this IConventionEntityType entityType) + public static ConfigurationSource? GetIsMemoryOptimizedConfigurationSource([NotNull] this IConventionEntityType entityType) => entityType.FindAnnotation(SqlServerAnnotationNames.MemoryOptimized)?.GetConfigurationSource(); } } diff --git a/src/EFCore.SqlServer/Extensions/SqlServerIndexBuilderExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerIndexBuilderExtensions.cs index b449e2eb382..59403b6b544 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerIndexBuilderExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerIndexBuilderExtensions.cs @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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()); } /// @@ -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; } @@ -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; } diff --git a/src/EFCore.SqlServer/Extensions/SqlServerIndexExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerIndexExtensions.cs index f4157aee247..1522b639203 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerIndexExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerIndexExtensions.cs @@ -19,7 +19,7 @@ public static class SqlServerIndexExtensions /// /// The index. /// true if the index is clustered. - public static bool? GetSqlServerIsClustered([NotNull] this IIndex index) + public static bool? IsClustered([NotNull] this IIndex index) => (bool?)index[SqlServerAnnotationNames.Clustered]; /// @@ -27,7 +27,7 @@ public static class SqlServerIndexExtensions /// /// The value to set. /// The index. - 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); @@ -38,7 +38,7 @@ public static void SetSqlServerIsClustered([NotNull] this IMutableIndex index, b /// The value to set. /// The index. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerIsClustered( + public static void SetIsClustered( [NotNull] this IConventionIndex index, bool? value, bool fromDataAnnotation = false) => index.SetOrRemoveAnnotation( SqlServerAnnotationNames.Clustered, @@ -50,7 +50,7 @@ public static void SetSqlServerIsClustered( /// /// The property. /// The for whether the index is clustered. - public static ConfigurationSource? GetSqlServerIsClusteredConfigurationSource([NotNull] this IConventionIndex property) + public static ConfigurationSource? GetIsClusteredConfigurationSource([NotNull] this IConventionIndex property) => property.FindAnnotation(SqlServerAnnotationNames.Clustered)?.GetConfigurationSource(); /// @@ -58,7 +58,7 @@ public static void SetSqlServerIsClustered( /// /// The index. /// The included property names, or null if they have not been specified. - public static IReadOnlyList GetSqlServerIncludeProperties([NotNull] this IIndex index) + public static IReadOnlyList GetIncludeProperties([NotNull] this IIndex index) => (string[])index[SqlServerAnnotationNames.Include]; /// @@ -66,7 +66,7 @@ public static IReadOnlyList GetSqlServerIncludeProperties([NotNull] this /// /// The index. /// The value to set. - public static void SetSqlServerIncludeProperties([NotNull] this IMutableIndex index, [NotNull] IReadOnlyList properties) + public static void SetIncludeProperties([NotNull] this IMutableIndex index, [NotNull] IReadOnlyList properties) => index.SetOrRemoveAnnotation( SqlServerAnnotationNames.Include, properties); @@ -77,7 +77,7 @@ public static void SetSqlServerIncludeProperties([NotNull] this IMutableIndex in /// The index. /// Indicates whether the configuration was specified using a data annotation. /// The value to set. - public static void SetSqlServerIncludeProperties( + public static void SetIncludeProperties( [NotNull] this IConventionIndex index, [NotNull] IReadOnlyList properties, bool fromDataAnnotation = false) => index.SetOrRemoveAnnotation( SqlServerAnnotationNames.Include, @@ -89,7 +89,7 @@ public static void SetSqlServerIncludeProperties( /// /// The index. /// The for the included property names. - public static ConfigurationSource? GetSqlServerIncludePropertiesConfigurationSource([NotNull] this IConventionIndex index) + public static ConfigurationSource? GetIncludePropertiesConfigurationSource([NotNull] this IConventionIndex index) => index.FindAnnotation(SqlServerAnnotationNames.Include)?.GetConfigurationSource(); /// @@ -97,7 +97,7 @@ public static void SetSqlServerIncludeProperties( /// /// The index. /// true if the index is online. - public static bool? GetSqlServerIsCreatedOnline([NotNull] this IIndex index) + public static bool? IsCreatedOnline([NotNull] this IIndex index) => (bool?)index[SqlServerAnnotationNames.CreatedOnline]; /// @@ -105,7 +105,7 @@ public static void SetSqlServerIncludeProperties( /// /// The index. /// The value to set. - 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); @@ -116,7 +116,7 @@ public static void SetSqlServerIsCreatedOnline([NotNull] this IMutableIndex inde /// The index. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerIsCreatedOnline( + public static void SetIsCreatedOnline( [NotNull] this IConventionIndex index, bool? createdOnline, bool fromDataAnnotation = false) => index.SetOrRemoveAnnotation( SqlServerAnnotationNames.CreatedOnline, @@ -128,7 +128,7 @@ public static void SetSqlServerIsCreatedOnline( /// /// The index. /// The for whether the index is online. - public static ConfigurationSource? GetSqlServerIsCreatedOnlineConfigurationSource([NotNull] this IConventionIndex index) + public static ConfigurationSource? GetIsCreatedOnlineConfigurationSource([NotNull] this IConventionIndex index) => index.FindAnnotation(SqlServerAnnotationNames.CreatedOnline)?.GetConfigurationSource(); } } diff --git a/src/EFCore.SqlServer/Extensions/SqlServerKeyBuilderExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerKeyBuilderExtensions.cs index d2f9f870975..90f391ba21c 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerKeyBuilderExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerKeyBuilderExtensions.cs @@ -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; } @@ -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; } diff --git a/src/EFCore.SqlServer/Extensions/SqlServerKeyExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerKeyExtensions.cs index f4e632cf1f3..af77effe13e 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerKeyExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerKeyExtensions.cs @@ -18,13 +18,13 @@ public static class SqlServerKeyExtensions /// /// The key. /// true if the key is clustered. - 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(); } /// @@ -32,7 +32,7 @@ public static class SqlServerKeyExtensions /// /// The key. /// The value to set. - 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); /// @@ -41,7 +41,7 @@ public static void SetSqlServerIsClustered([NotNull] this IMutableKey key, bool? /// The key. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - 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); /// @@ -49,7 +49,7 @@ public static void SetSqlServerIsClustered([NotNull] this IConventionKey key, bo /// /// The key. /// The for whether the key is clustered. - public static ConfigurationSource? GetSqlServerIsClusteredConfigurationSource([NotNull] this IConventionKey key) + public static ConfigurationSource? GetIsClusteredConfigurationSource([NotNull] this IConventionKey key) => key.FindAnnotation(SqlServerAnnotationNames.Clustered)?.GetConfigurationSource(); } } diff --git a/src/EFCore.SqlServer/Extensions/SqlServerModelBuilderExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerModelBuilderExtensions.cs index 1df33744aeb..6254d18cfd0 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerModelBuilderExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerModelBuilderExtensions.cs @@ -42,11 +42,11 @@ public static ModelBuilder UseHiLo( modelBuilder.HasSequence(name, schema).IncrementsBy(10); } - model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - model.SetSqlServerHiLoSequenceName(name); - model.SetSqlServerHiLoSequenceSchema(schema); - model.SetSqlServerIdentitySeed(null); - model.SetSqlServerIdentityIncrement(null); + model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + model.SetHiLoSequenceName(name); + model.SetHiLoSequenceSchema(schema); + model.SetIdentitySeed(null); + model.SetIdentityIncrement(null); return modelBuilder; } @@ -71,8 +71,8 @@ public static IConventionSequenceBuilder HasHiLoSequence( return null; } - modelBuilder.Metadata.SetSqlServerHiLoSequenceName(name, fromDataAnnotation); - modelBuilder.Metadata.SetSqlServerHiLoSequenceSchema(schema, fromDataAnnotation); + modelBuilder.Metadata.SetHiLoSequenceName(name, fromDataAnnotation); + modelBuilder.Metadata.SetHiLoSequenceSchema(schema, fromDataAnnotation); return name == null ? null : modelBuilder.HasSequence(name, schema, fromDataAnnotation); } @@ -117,11 +117,11 @@ public static ModelBuilder UseIdentityColumns( var model = modelBuilder.Model; - model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); - model.SetSqlServerIdentitySeed(seed); - model.SetSqlServerIdentityIncrement(increment); - model.SetSqlServerHiLoSequenceName(null); - model.SetSqlServerHiLoSequenceSchema(null); + model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); + model.SetIdentitySeed(seed); + model.SetIdentityIncrement(increment); + model.SetHiLoSequenceName(null); + model.SetHiLoSequenceSchema(null); return modelBuilder; } @@ -141,7 +141,7 @@ public static IConventionModelBuilder HasIdentityColumnSeed( { if (modelBuilder.CanSetIdentityColumnSeed(seed, fromDataAnnotation)) { - modelBuilder.Metadata.SetSqlServerIdentitySeed(seed, fromDataAnnotation); + modelBuilder.Metadata.SetIdentitySeed(seed, fromDataAnnotation); return modelBuilder; } @@ -178,7 +178,7 @@ public static IConventionModelBuilder HasIdentityColumnIncrement( { if (modelBuilder.CanSetIdentityColumnIncrement(increment, fromDataAnnotation)) { - modelBuilder.Metadata.SetSqlServerIdentityIncrement(increment, fromDataAnnotation); + modelBuilder.Metadata.SetIdentityIncrement(increment, fromDataAnnotation); return modelBuilder; } @@ -218,7 +218,7 @@ public static IConventionModelBuilder HasValueGenerationStrategy( { if (modelBuilder.CanSetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation)) { - modelBuilder.Metadata.SetSqlServerValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); + modelBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); if (valueGenerationStrategy != SqlServerValueGenerationStrategy.IdentityColumn) { modelBuilder.HasIdentityColumnSeed(null, fromDataAnnotation); diff --git a/src/EFCore.SqlServer/Extensions/SqlServerModelExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerModelExtensions.cs index d402819ca66..abc1b685e51 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerModelExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerModelExtensions.cs @@ -24,7 +24,7 @@ public static class SqlServerModelExtensions /// /// The model. /// The name to use for the default hi-lo sequence. - public static string GetSqlServerHiLoSequenceName([NotNull] this IModel model) + public static string GetHiLoSequenceName([NotNull] this IModel model) => (string)model[SqlServerAnnotationNames.HiLoSequenceName] ?? DefaultHiLoSequenceName; @@ -33,7 +33,7 @@ public static string GetSqlServerHiLoSequenceName([NotNull] this IModel model) /// /// The model. /// The value to set. - public static void SetSqlServerHiLoSequenceName([NotNull] this IMutableModel model, [CanBeNull] string name) + public static void SetHiLoSequenceName([NotNull] this IMutableModel model, [CanBeNull] string name) { Check.NullButNotEmpty(name, nameof(name)); @@ -46,7 +46,7 @@ public static void SetSqlServerHiLoSequenceName([NotNull] this IMutableModel mod /// The model. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerHiLoSequenceName( + public static void SetHiLoSequenceName( [NotNull] this IConventionModel model, [CanBeNull] string name, bool fromDataAnnotation = false) { Check.NullButNotEmpty(name, nameof(name)); @@ -59,7 +59,7 @@ public static void SetSqlServerHiLoSequenceName( /// /// The model. /// The for the default hi-lo sequence name. - public static ConfigurationSource? GetSqlServerHiLoSequenceNameConfigurationSource([NotNull] this IConventionModel model) + public static ConfigurationSource? GetHiLoSequenceNameConfigurationSource([NotNull] this IConventionModel model) => model.FindAnnotation(SqlServerAnnotationNames.HiLoSequenceName)?.GetConfigurationSource(); /// @@ -68,7 +68,7 @@ public static void SetSqlServerHiLoSequenceName( /// /// The model. /// The schema to use for the default hi-lo sequence. - public static string GetSqlServerHiLoSequenceSchema([NotNull] this IModel model) + public static string GetHiLoSequenceSchema([NotNull] this IModel model) => (string)model[SqlServerAnnotationNames.HiLoSequenceSchema]; /// @@ -76,7 +76,7 @@ public static string GetSqlServerHiLoSequenceSchema([NotNull] this IModel model) /// /// The model. /// The value to set. - public static void SetSqlServerHiLoSequenceSchema([NotNull] this IMutableModel model, [CanBeNull] string value) + public static void SetHiLoSequenceSchema([NotNull] this IMutableModel model, [CanBeNull] string value) { Check.NullButNotEmpty(value, nameof(value)); @@ -89,7 +89,7 @@ public static void SetSqlServerHiLoSequenceSchema([NotNull] this IMutableModel m /// The model. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerHiLoSequenceSchema( + public static void SetHiLoSequenceSchema( [NotNull] this IConventionModel model, [CanBeNull] string value, bool fromDataAnnotation = false) { Check.NullButNotEmpty(value, nameof(value)); @@ -102,7 +102,7 @@ public static void SetSqlServerHiLoSequenceSchema( /// /// The model. /// The for the default hi-lo sequence schema. - public static ConfigurationSource? GetSqlServerHiLoSequenceSchemaConfigurationSource([NotNull] this IConventionModel model) + public static ConfigurationSource? GetHiLoSequenceSchemaConfigurationSource([NotNull] this IConventionModel model) => model.FindAnnotation(SqlServerAnnotationNames.HiLoSequenceSchema)?.GetConfigurationSource(); /// @@ -110,7 +110,7 @@ public static void SetSqlServerHiLoSequenceSchema( /// /// The model. /// The default identity seed. - public static int GetSqlServerIdentitySeed([NotNull] this IModel model) + public static int GetIdentitySeed([NotNull] this IModel model) => (int?)model[SqlServerAnnotationNames.IdentitySeed] ?? 1; /// @@ -118,7 +118,7 @@ public static int GetSqlServerIdentitySeed([NotNull] this IModel model) /// /// The model. /// The value to set. - public static void SetSqlServerIdentitySeed([NotNull] this IMutableModel model, int? seed) + public static void SetIdentitySeed([NotNull] this IMutableModel model, int? seed) => model.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentitySeed, seed); @@ -129,7 +129,7 @@ public static void SetSqlServerIdentitySeed([NotNull] this IMutableModel model, /// The model. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerIdentitySeed([NotNull] this IConventionModel model, int? seed, bool fromDataAnnotation = false) + public static void SetIdentitySeed([NotNull] this IConventionModel model, int? seed, bool fromDataAnnotation = false) => model.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentitySeed, seed, @@ -140,7 +140,7 @@ public static void SetSqlServerIdentitySeed([NotNull] this IConventionModel mode /// /// The model. /// The for the default schema. - public static ConfigurationSource? GetSqlServerIdentitySeedConfigurationSource([NotNull] this IConventionModel model) + public static ConfigurationSource? GetIdentitySeedConfigurationSource([NotNull] this IConventionModel model) => model.FindAnnotation(SqlServerAnnotationNames.IdentitySeed)?.GetConfigurationSource(); /// @@ -148,7 +148,7 @@ public static void SetSqlServerIdentitySeed([NotNull] this IConventionModel mode /// /// The model. /// The default identity increment. - public static int GetSqlServerIdentityIncrement([NotNull] this IModel model) + public static int GetIdentityIncrement([NotNull] this IModel model) => (int?)model[SqlServerAnnotationNames.IdentityIncrement] ?? 1; /// @@ -156,7 +156,7 @@ public static int GetSqlServerIdentityIncrement([NotNull] this IModel model) /// /// The model. /// The value to set. - public static void SetSqlServerIdentityIncrement([NotNull] this IMutableModel model, int? increment) + public static void SetIdentityIncrement([NotNull] this IMutableModel model, int? increment) => model.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentityIncrement, increment); @@ -167,7 +167,7 @@ public static void SetSqlServerIdentityIncrement([NotNull] this IMutableModel mo /// The model. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerIdentityIncrement( + public static void SetIdentityIncrement( [NotNull] this IConventionModel model, int? increment, bool fromDataAnnotation = false) => model.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentityIncrement, @@ -179,7 +179,7 @@ public static void SetSqlServerIdentityIncrement( /// /// The model. /// The for the default identity increment. - public static ConfigurationSource? GetSqlServerIdentityIncrementConfigurationSource([NotNull] this IConventionModel model) + public static ConfigurationSource? GetIdentityIncrementConfigurationSource([NotNull] this IConventionModel model) => model.FindAnnotation(SqlServerAnnotationNames.IdentityIncrement)?.GetConfigurationSource(); /// @@ -188,7 +188,7 @@ public static void SetSqlServerIdentityIncrement( /// /// The model. /// The default . - public static SqlServerValueGenerationStrategy? GetSqlServerValueGenerationStrategy([NotNull] this IModel model) + public static SqlServerValueGenerationStrategy? GetValueGenerationStrategy([NotNull] this IModel model) => (SqlServerValueGenerationStrategy?)model[SqlServerAnnotationNames.ValueGenerationStrategy]; /// @@ -197,7 +197,7 @@ public static void SetSqlServerIdentityIncrement( /// /// The model. /// The value to set. - public static void SetSqlServerValueGenerationStrategy([NotNull] this IMutableModel model, SqlServerValueGenerationStrategy? value) + public static void SetValueGenerationStrategy([NotNull] this IMutableModel model, SqlServerValueGenerationStrategy? value) => model.SetOrRemoveAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy, value); /// @@ -207,7 +207,7 @@ public static void SetSqlServerValueGenerationStrategy([NotNull] this IMutableMo /// The model. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerValueGenerationStrategy( + public static void SetValueGenerationStrategy( [NotNull] this IConventionModel model, SqlServerValueGenerationStrategy? value, bool fromDataAnnotation = false) => model.SetOrRemoveAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy, value, fromDataAnnotation); @@ -216,7 +216,7 @@ public static void SetSqlServerValueGenerationStrategy( /// /// The model. /// The for the default . - public static ConfigurationSource? GetSqlServerValueGenerationStrategyConfigurationSource([NotNull] this IConventionModel model) + public static ConfigurationSource? GetValueGenerationStrategyConfigurationSource([NotNull] this IConventionModel model) => model.FindAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy)?.GetConfigurationSource(); } } diff --git a/src/EFCore.SqlServer/Extensions/SqlServerPropertyBuilderExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerPropertyBuilderExtensions.cs index f1c65a2585e..a1219156a68 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerPropertyBuilderExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerPropertyBuilderExtensions.cs @@ -44,11 +44,11 @@ public static PropertyBuilder UseHiLo( model.AddSequence(name, schema).IncrementBy = 10; } - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - property.SetSqlServerHiLoSequenceName(name); - property.SetSqlServerHiLoSequenceSchema(schema); - property.SetSqlServerIdentitySeed(null); - property.SetSqlServerIdentityIncrement(null); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + property.SetHiLoSequenceName(name); + property.SetHiLoSequenceSchema(schema); + property.SetIdentitySeed(null); + property.SetIdentityIncrement(null); return propertyBuilder; } @@ -88,8 +88,8 @@ public static IConventionSequenceBuilder HasHiLoSequence( return null; } - propertyBuilder.Metadata.SetSqlServerHiLoSequenceName(name, fromDataAnnotation); - propertyBuilder.Metadata.SetSqlServerHiLoSequenceSchema(schema, fromDataAnnotation); + propertyBuilder.Metadata.SetHiLoSequenceName(name, fromDataAnnotation); + propertyBuilder.Metadata.SetHiLoSequenceSchema(schema, fromDataAnnotation); return name == null ? null @@ -134,11 +134,11 @@ public static PropertyBuilder UseIdentityColumn( Check.NotNull(propertyBuilder, nameof(propertyBuilder)); var property = propertyBuilder.Metadata; - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); - property.SetSqlServerIdentitySeed(seed); - property.SetSqlServerIdentityIncrement(increment); - property.SetSqlServerHiLoSequenceName(null); - property.SetSqlServerHiLoSequenceSchema(null); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); + property.SetIdentitySeed(seed); + property.SetIdentityIncrement(increment); + property.SetHiLoSequenceName(null); + property.SetHiLoSequenceSchema(null); return propertyBuilder; } @@ -173,7 +173,7 @@ public static IConventionPropertyBuilder HasIdentityColumnSeed( { if (propertyBuilder.CanSetIdentityColumnSeed(seed, fromDataAnnotation)) { - propertyBuilder.Metadata.SetSqlServerIdentitySeed(seed, fromDataAnnotation); + propertyBuilder.Metadata.SetIdentitySeed(seed, fromDataAnnotation); return propertyBuilder; } @@ -210,7 +210,7 @@ public static IConventionPropertyBuilder HasIdentityColumnIncrement( { if (propertyBuilder.CanSetIdentityColumnIncrement(increment, fromDataAnnotation)) { - propertyBuilder.Metadata.SetSqlServerIdentityIncrement(increment, fromDataAnnotation); + propertyBuilder.Metadata.SetIdentityIncrement(increment, fromDataAnnotation); return propertyBuilder; } @@ -250,7 +250,7 @@ public static IConventionPropertyBuilder HasValueGenerationStrategy( if (propertyBuilder.CanSetAnnotation( SqlServerAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)) { - propertyBuilder.Metadata.SetSqlServerValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); + propertyBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); if (valueGenerationStrategy != SqlServerValueGenerationStrategy.IdentityColumn) { propertyBuilder.HasIdentityColumnSeed(null, fromDataAnnotation); diff --git a/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs b/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs index bfdaf4adfe8..7e9812f45c5 100644 --- a/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs +++ b/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs @@ -22,7 +22,7 @@ public static class SqlServerPropertyExtensions /// /// The property. /// The name to use for the hi-lo sequence. - public static string GetSqlServerHiLoSequenceName([NotNull] this IProperty property) + public static string GetHiLoSequenceName([NotNull] this IProperty property) => (string)property[SqlServerAnnotationNames.HiLoSequenceName]; /// @@ -30,7 +30,7 @@ public static string GetSqlServerHiLoSequenceName([NotNull] this IProperty prope /// /// The property. /// The sequence name to use. - public static void SetSqlServerHiLoSequenceName([NotNull] this IMutableProperty property, [CanBeNull] string name) + public static void SetHiLoSequenceName([NotNull] this IMutableProperty property, [CanBeNull] string name) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.HiLoSequenceName, Check.NullButNotEmpty(name, nameof(name))); @@ -41,7 +41,7 @@ public static void SetSqlServerHiLoSequenceName([NotNull] this IMutableProperty /// The property. /// The sequence name to use. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerHiLoSequenceName( + public static void SetHiLoSequenceName( [NotNull] this IConventionProperty property, [CanBeNull] string name, bool fromDataAnnotation = false) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.HiLoSequenceName, @@ -53,7 +53,7 @@ public static void SetSqlServerHiLoSequenceName( /// /// The property. /// The for the hi-lo sequence name. - public static ConfigurationSource? GetSqlServerHiLoSequenceNameConfigurationSource([NotNull] this IConventionProperty property) + public static ConfigurationSource? GetHiLoSequenceNameConfigurationSource([NotNull] this IConventionProperty property) => property.FindAnnotation(SqlServerAnnotationNames.HiLoSequenceName)?.GetConfigurationSource(); /// @@ -61,7 +61,7 @@ public static void SetSqlServerHiLoSequenceName( /// /// The property. /// The schema to use for the hi-lo sequence. - public static string GetSqlServerHiLoSequenceSchema([NotNull] this IProperty property) + public static string GetHiLoSequenceSchema([NotNull] this IProperty property) => (string)property[SqlServerAnnotationNames.HiLoSequenceSchema]; /// @@ -69,7 +69,7 @@ public static string GetSqlServerHiLoSequenceSchema([NotNull] this IProperty pro /// /// The property. /// The schema to use. - public static void SetSqlServerHiLoSequenceSchema([NotNull] this IMutableProperty property, [CanBeNull] string schema) + public static void SetHiLoSequenceSchema([NotNull] this IMutableProperty property, [CanBeNull] string schema) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.HiLoSequenceSchema, Check.NullButNotEmpty(schema, nameof(schema))); @@ -80,7 +80,7 @@ public static void SetSqlServerHiLoSequenceSchema([NotNull] this IMutablePropert /// The property. /// The schema to use. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerHiLoSequenceSchema( + public static void SetHiLoSequenceSchema( [NotNull] this IConventionProperty property, [CanBeNull] string schema, bool fromDataAnnotation = false) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.HiLoSequenceSchema, @@ -92,27 +92,27 @@ public static void SetSqlServerHiLoSequenceSchema( /// /// The property. /// The for the hi-lo sequence schema. - public static ConfigurationSource? GetSqlServerHiLoSequenceSchemaConfigurationSource([NotNull] this IConventionProperty property) + public static ConfigurationSource? GetHiLoSequenceSchemaConfigurationSource([NotNull] this IConventionProperty property) => property.FindAnnotation(SqlServerAnnotationNames.HiLoSequenceSchema)?.GetConfigurationSource(); /// /// Finds the in the model to use for the hi-lo pattern. /// /// The sequence to use, or null if no sequence exists in the model. - public static ISequence FindSqlServerHiLoSequence([NotNull] this IProperty property) + public static ISequence FindHiLoSequence([NotNull] this IProperty property) { var model = property.DeclaringEntityType.Model; - if (property.GetSqlServerValueGenerationStrategy() != SqlServerValueGenerationStrategy.SequenceHiLo) + if (property.GetValueGenerationStrategy() != SqlServerValueGenerationStrategy.SequenceHiLo) { return null; } - var sequenceName = property.GetSqlServerHiLoSequenceName() - ?? model.GetSqlServerHiLoSequenceName(); + var sequenceName = property.GetHiLoSequenceName() + ?? model.GetHiLoSequenceName(); - var sequenceSchema = property.GetSqlServerHiLoSequenceSchema() - ?? model.GetSqlServerHiLoSequenceSchema(); + var sequenceSchema = property.GetHiLoSequenceSchema() + ?? model.GetHiLoSequenceSchema(); return model.FindSequence(sequenceName, sequenceSchema); } @@ -122,7 +122,7 @@ public static ISequence FindSqlServerHiLoSequence([NotNull] this IProperty prope /// /// The property. /// The identity seed. - public static int? GetSqlServerIdentitySeed([NotNull] this IProperty property) + public static int? GetIdentitySeed([NotNull] this IProperty property) => (int?)property[SqlServerAnnotationNames.IdentitySeed]; /// @@ -130,7 +130,7 @@ public static ISequence FindSqlServerHiLoSequence([NotNull] this IProperty prope /// /// The property. /// The value to set. - public static void SetSqlServerIdentitySeed([NotNull] this IMutableProperty property, int? seed) + public static void SetIdentitySeed([NotNull] this IMutableProperty property, int? seed) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentitySeed, seed); @@ -141,7 +141,7 @@ public static void SetSqlServerIdentitySeed([NotNull] this IMutableProperty prop /// The property. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerIdentitySeed( + public static void SetIdentitySeed( [NotNull] this IConventionProperty property, int? seed, bool fromDataAnnotation = false) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentitySeed, @@ -153,7 +153,7 @@ public static void SetSqlServerIdentitySeed( /// /// The property. /// The for the identity seed. - public static ConfigurationSource? GetSqlServerIdentitySeedConfigurationSource([NotNull] this IConventionProperty property) + public static ConfigurationSource? GetIdentitySeedConfigurationSource([NotNull] this IConventionProperty property) => property.FindAnnotation(SqlServerAnnotationNames.IdentitySeed)?.GetConfigurationSource(); /// @@ -161,7 +161,7 @@ public static void SetSqlServerIdentitySeed( /// /// The property. /// The identity increment. - public static int? GetSqlServerIdentityIncrement([NotNull] this IProperty property) + public static int? GetIdentityIncrement([NotNull] this IProperty property) => (int?)property[SqlServerAnnotationNames.IdentityIncrement]; /// @@ -169,7 +169,7 @@ public static void SetSqlServerIdentitySeed( /// /// The property. /// The value to set. - public static void SetSqlServerIdentityIncrement([NotNull] this IMutableProperty property, int? increment) + public static void SetIdentityIncrement([NotNull] this IMutableProperty property, int? increment) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentityIncrement, increment); @@ -180,7 +180,7 @@ public static void SetSqlServerIdentityIncrement([NotNull] this IMutableProperty /// The property. /// The value to set. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerIdentityIncrement( + public static void SetIdentityIncrement( [NotNull] this IConventionProperty property, int? increment, bool fromDataAnnotation = false) => property.SetOrRemoveAnnotation( SqlServerAnnotationNames.IdentityIncrement, @@ -192,7 +192,7 @@ public static void SetSqlServerIdentityIncrement( /// /// The property. /// The for the identity increment. - public static ConfigurationSource? GetSqlServerIdentityIncrementConfigurationSource([NotNull] this IConventionProperty property) + public static ConfigurationSource? GetIdentityIncrementConfigurationSource([NotNull] this IConventionProperty property) => property.FindAnnotation(SqlServerAnnotationNames.IdentityIncrement)?.GetConfigurationSource(); /// @@ -204,7 +204,7 @@ public static void SetSqlServerIdentityIncrement( /// /// /// The strategy, or if none was set. - public static SqlServerValueGenerationStrategy GetSqlServerValueGenerationStrategy([NotNull] this IProperty property) + public static SqlServerValueGenerationStrategy GetValueGenerationStrategy([NotNull] this IProperty property) { var annotation = property[SqlServerAnnotationNames.ValueGenerationStrategy]; if (annotation != null) @@ -215,7 +215,7 @@ public static SqlServerValueGenerationStrategy GetSqlServerValueGenerationStrate var sharedTablePrincipalPrimaryKeyProperty = property.FindSharedTableRootPrimaryKeyProperty(); if (sharedTablePrincipalPrimaryKeyProperty != null) { - return sharedTablePrincipalPrimaryKeyProperty.GetSqlServerValueGenerationStrategy() + return sharedTablePrincipalPrimaryKeyProperty.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn ? SqlServerValueGenerationStrategy.IdentityColumn : SqlServerValueGenerationStrategy.None; @@ -229,7 +229,7 @@ public static SqlServerValueGenerationStrategy GetSqlServerValueGenerationStrate return SqlServerValueGenerationStrategy.None; } - var modelStrategy = property.DeclaringEntityType.Model.GetSqlServerValueGenerationStrategy(); + var modelStrategy = property.DeclaringEntityType.Model.GetValueGenerationStrategy(); if (modelStrategy == SqlServerValueGenerationStrategy.SequenceHiLo && IsCompatibleWithValueGeneration(property)) @@ -248,10 +248,10 @@ public static SqlServerValueGenerationStrategy GetSqlServerValueGenerationStrate /// /// The property. /// The strategy to use. - public static void SetSqlServerValueGenerationStrategy( + public static void SetValueGenerationStrategy( [NotNull] this IMutableProperty property, SqlServerValueGenerationStrategy? value) { - CheckSqlServerValueGenerationStrategy(property, value); + CheckValueGenerationStrategy(property, value); property.SetOrRemoveAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy, value); } @@ -262,15 +262,15 @@ public static void SetSqlServerValueGenerationStrategy( /// The property. /// The strategy to use. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqlServerValueGenerationStrategy( + public static void SetValueGenerationStrategy( [NotNull] this IConventionProperty property, SqlServerValueGenerationStrategy? value, bool fromDataAnnotation = false) { - CheckSqlServerValueGenerationStrategy(property, value); + CheckValueGenerationStrategy(property, value); property.SetOrRemoveAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy, value, fromDataAnnotation); } - private static void CheckSqlServerValueGenerationStrategy(IProperty property, SqlServerValueGenerationStrategy? value) + private static void CheckValueGenerationStrategy(IProperty property, SqlServerValueGenerationStrategy? value) { if (value != null) { @@ -299,7 +299,7 @@ private static void CheckSqlServerValueGenerationStrategy(IProperty property, Sq /// /// The property. /// The for the . - public static ConfigurationSource? GetSqlServerValueGenerationStrategyConfigurationSource( + public static ConfigurationSource? GetValueGenerationStrategyConfigurationSource( [NotNull] this IConventionProperty property) => property.FindAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy)?.GetConfigurationSource(); diff --git a/src/EFCore.SqlServer/Internal/SqlServerModelValidator.cs b/src/EFCore.SqlServer/Internal/SqlServerModelValidator.cs index a1be4428f94..207ba1121cd 100644 --- a/src/EFCore.SqlServer/Internal/SqlServerModelValidator.cs +++ b/src/EFCore.SqlServer/Internal/SqlServerModelValidator.cs @@ -100,7 +100,7 @@ protected virtual void ValidateByteIdentityMapping([NotNull] IModel model, [NotN .SelectMany(t => t.GetDeclaredProperties()) .Where( p => p.ClrType.UnwrapNullableType() == typeof(byte) - && p.GetSqlServerValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn)) + && p.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn)) { logger.ByteIdentityColumnWarning(property); } @@ -117,8 +117,8 @@ protected virtual void ValidateNonKeyValueGeneration([NotNull] IModel model, [No foreach (var property in model.GetEntityTypes() .SelectMany(t => t.GetDeclaredProperties()) .Where( - p => p.GetSqlServerValueGenerationStrategy() == SqlServerValueGenerationStrategy.SequenceHiLo - && ((IConventionProperty)p).GetSqlServerValueGenerationStrategyConfigurationSource() != null + p => p.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.SequenceHiLo + && ((IConventionProperty)p).GetValueGenerationStrategyConfigurationSource() != null && !p.IsKey() && p.ValueGenerated != ValueGenerated.Never && (!(p.FindAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy) is ConventionAnnotation strategy) @@ -139,7 +139,7 @@ protected virtual void ValidateIndexIncludeProperties([NotNull] IModel model, [N { foreach (var index in model.GetEntityTypes().SelectMany(t => t.GetDeclaredIndexes())) { - var includeProperties = index.GetSqlServerIncludeProperties(); + var includeProperties = index.GetIncludeProperties(); if (includeProperties?.Count > 0) { var notFound = includeProperties @@ -185,11 +185,11 @@ protected override void ValidateSharedTableCompatibility( IReadOnlyList mappedTypes, string tableName, IDiagnosticsLogger logger) { var firstMappedType = mappedTypes[0]; - var isMemoryOptimized = firstMappedType.GetSqlServerIsMemoryOptimized(); + var isMemoryOptimized = firstMappedType.IsMemoryOptimized(); foreach (var otherMappedType in mappedTypes.Skip(1)) { - if (isMemoryOptimized != otherMappedType.GetSqlServerIsMemoryOptimized()) + if (isMemoryOptimized != otherMappedType.IsMemoryOptimized()) { throw new InvalidOperationException( SqlServerStrings.IncompatibleTableMemoryOptimizedMismatch( @@ -221,8 +221,8 @@ protected override void ValidateSharedColumnsCompatibility( var columnName = property.GetColumnName(); if (propertyMappings.TryGetValue(columnName, out var duplicateProperty)) { - var propertyStrategy = property.GetSqlServerValueGenerationStrategy(); - var duplicatePropertyStrategy = duplicateProperty.GetSqlServerValueGenerationStrategy(); + var propertyStrategy = property.GetValueGenerationStrategy(); + var duplicatePropertyStrategy = duplicateProperty.GetValueGenerationStrategy(); if (propertyStrategy != duplicatePropertyStrategy && (propertyStrategy == SqlServerValueGenerationStrategy.IdentityColumn || duplicatePropertyStrategy == SqlServerValueGenerationStrategy.IdentityColumn)) @@ -240,7 +240,7 @@ protected override void ValidateSharedColumnsCompatibility( else { propertyMappings[columnName] = property; - if (property.GetSqlServerValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn) + if (property.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn) { identityColumns.Add(property); } @@ -278,8 +278,8 @@ protected override void ValidateSharedKeysCompatibility( continue; } - if (key.GetSqlServerIsClustered() - != duplicateKey.GetSqlServerIsClustered()) + if (key.IsClustered() + != duplicateKey.IsClustered()) { throw new InvalidOperationException( SqlServerStrings.DuplicateKeyMismatchedClustering( diff --git a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerIndexConvention.cs b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerIndexConvention.cs index 093a9770403..8ccf072266c 100644 --- a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerIndexConvention.cs +++ b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerIndexConvention.cs @@ -151,7 +151,7 @@ private IConventionIndexBuilder SetIndexFilter(IConventionIndexBuilder indexBuil { var index = indexBuilder.Metadata; if (index.IsUnique - && index.GetSqlServerIsClustered() != true + && index.IsClustered() != true && index.Properties .Any(property => property.IsColumnNullable())) { diff --git a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerMemoryOptimizedTablesConvention.cs b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerMemoryOptimizedTablesConvention.cs index ab1d5058f6d..2af20680181 100644 --- a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerMemoryOptimizedTablesConvention.cs +++ b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerMemoryOptimizedTablesConvention.cs @@ -73,7 +73,7 @@ public virtual void ProcessEntityTypeAnnotationChanged( /// Additional information associated with convention execution. public virtual void ProcessKeyAdded(IConventionKeyBuilder keyBuilder, IConventionContext context) { - if (keyBuilder.Metadata.DeclaringEntityType.GetSqlServerIsMemoryOptimized()) + if (keyBuilder.Metadata.DeclaringEntityType.IsMemoryOptimized()) { keyBuilder.IsClustered(false); } @@ -86,7 +86,7 @@ public virtual void ProcessKeyAdded(IConventionKeyBuilder keyBuilder, IConventio /// Additional information associated with convention execution. public virtual void ProcessIndexAdded(IConventionIndexBuilder indexBuilder, IConventionContext context) { - if (indexBuilder.Metadata.DeclaringEntityType.GetAllBaseTypesInclusive().Any(et => et.GetSqlServerIsMemoryOptimized())) + if (indexBuilder.Metadata.DeclaringEntityType.GetAllBaseTypesInclusive().Any(et => et.IsMemoryOptimized())) { indexBuilder.IsClustered(false); } diff --git a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerStoreGenerationConvention.cs b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerStoreGenerationConvention.cs index 593f8ae15a8..4284f8842c3 100644 --- a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerStoreGenerationConvention.cs +++ b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerStoreGenerationConvention.cs @@ -99,8 +99,8 @@ public override void ProcessPropertyAnnotationChanged( protected override void Validate(IConventionProperty property) { - if (property.GetSqlServerValueGenerationStrategyConfigurationSource() != null - && property.GetSqlServerValueGenerationStrategy() != SqlServerValueGenerationStrategy.None) + if (property.GetValueGenerationStrategyConfigurationSource() != null + && property.GetValueGenerationStrategy() != SqlServerValueGenerationStrategy.None) { if (property.GetDefaultValue() != null) { diff --git a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationConvention.cs b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationConvention.cs index 11b0c5841ae..624c0348098 100644 --- a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationConvention.cs +++ b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationConvention.cs @@ -68,7 +68,7 @@ public override void ProcessPropertyAnnotationChanged( /// The store value generation strategy to set for the given property. public static new ValueGenerated? GetValueGenerated([NotNull] IProperty property) => RelationalValueGenerationConvention.GetValueGenerated(property) - ?? (property.GetSqlServerValueGenerationStrategy() != SqlServerValueGenerationStrategy.None + ?? (property.GetValueGenerationStrategy() != SqlServerValueGenerationStrategy.None ? ValueGenerated.OnAdd : (ValueGenerated?)null); } diff --git a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationStrategyConvention.cs b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationStrategyConvention.cs index 3a6014ff497..d3df05ee417 100644 --- a/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationStrategyConvention.cs +++ b/src/EFCore.SqlServer/Metadata/Conventions/SqlServerValueGenerationStrategyConvention.cs @@ -54,7 +54,7 @@ public virtual void ProcessModelFinalized( foreach (var property in entityType.GetDeclaredProperties()) { // Needed for the annotation to show up in the model snapshot - var strategy = property.GetSqlServerValueGenerationStrategy(); + var strategy = property.GetValueGenerationStrategy(); if (strategy != SqlServerValueGenerationStrategy.None) { property.Builder.HasValueGenerationStrategy(strategy); diff --git a/src/EFCore.SqlServer/Migrations/Internal/SqlServerMigrationsAnnotationProvider.cs b/src/EFCore.SqlServer/Migrations/Internal/SqlServerMigrationsAnnotationProvider.cs index dddb0e5ef7f..ded1ce00989 100644 --- a/src/EFCore.SqlServer/Migrations/Internal/SqlServerMigrationsAnnotationProvider.cs +++ b/src/EFCore.SqlServer/Migrations/Internal/SqlServerMigrationsAnnotationProvider.cs @@ -60,7 +60,7 @@ public SqlServerMigrationsAnnotationProvider([NotNull] MigrationsAnnotationProvi /// public override IEnumerable For(IKey key) { - var isClustered = key.GetSqlServerIsClustered(); + var isClustered = key.IsClustered(); if (isClustered.HasValue) { yield return new Annotation( @@ -77,7 +77,7 @@ public override IEnumerable For(IKey key) /// public override IEnumerable For(IIndex index) { - var isClustered = index.GetSqlServerIsClustered(); + var isClustered = index.IsClustered(); if (isClustered.HasValue) { yield return new Annotation( @@ -85,7 +85,7 @@ public override IEnumerable For(IIndex index) isClustered.Value); } - var includeProperties = index.GetSqlServerIncludeProperties(); + var includeProperties = index.GetIncludeProperties(); if (includeProperties != null) { yield return new Annotation( @@ -93,7 +93,7 @@ public override IEnumerable For(IIndex index) includeProperties); } - var isOnline = index.GetSqlServerIsCreatedOnline(); + var isOnline = index.IsCreatedOnline(); if (isOnline.HasValue) { yield return new Annotation( @@ -110,13 +110,13 @@ public override IEnumerable For(IIndex index) /// public override IEnumerable For(IProperty property) { - if (property.GetSqlServerValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn) + if (property.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn) { yield return new Annotation( SqlServerAnnotationNames.ValueGenerationStrategy, SqlServerValueGenerationStrategy.IdentityColumn); - var seed = property.GetSqlServerIdentitySeed(); + var seed = property.GetIdentitySeed(); if (seed.HasValue) { yield return new Annotation( @@ -124,7 +124,7 @@ public override IEnumerable For(IProperty property) seed.Value); } - var increment = property.GetSqlServerIdentityIncrement(); + var increment = property.GetIdentityIncrement(); if (increment.HasValue) { yield return new Annotation( @@ -143,7 +143,7 @@ public override IEnumerable For(IProperty property) /// public override IEnumerable ForRemove(IModel model) { - if (model.GetEntityTypes().Any(e => e.BaseType == null && e.GetSqlServerIsMemoryOptimized())) + if (model.GetEntityTypes().Any(e => e.BaseType == null && e.IsMemoryOptimized())) { yield return new Annotation( SqlServerAnnotationNames.MemoryOptimized, @@ -168,6 +168,6 @@ public override IEnumerable ForRemove(IEntityType entityType) } private static bool IsMemoryOptimized(IEntityType entityType) - => entityType.GetAllBaseTypesInclusive().Any(t => t.GetSqlServerIsMemoryOptimized()); + => entityType.GetAllBaseTypesInclusive().Any(t => t.IsMemoryOptimized()); } } diff --git a/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs b/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs index 2c37b591f78..6427972e44d 100644 --- a/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs +++ b/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs @@ -1563,7 +1563,7 @@ protected virtual IEnumerable GetIndexesToRebuild( { yield return index; } - else if (index.GetSqlServerIncludeProperties() is IReadOnlyList includeProperties) + else if (index.GetIncludeProperties() is IReadOnlyList includeProperties) { if (includeProperties.Contains(property.Name)) { @@ -1758,7 +1758,7 @@ private string IntegerConstant(long value) private bool IsMemoryOptimized(Annotatable annotatable, IModel model, string schema, string tableName) => annotatable[SqlServerAnnotationNames.MemoryOptimized] as bool? - ?? FindEntityTypes(model, schema, tableName)?.Any(t => t.GetSqlServerIsMemoryOptimized()) == true; + ?? FindEntityTypes(model, schema, tableName)?.Any(t => t.IsMemoryOptimized()) == true; private static bool IsMemoryOptimized(Annotatable annotatable) => annotatable[SqlServerAnnotationNames.MemoryOptimized] as bool? == true; diff --git a/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs b/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs index 953f4115b40..58775242b0d 100644 --- a/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs +++ b/src/EFCore.SqlServer/Update/Internal/SqlServerUpdateSqlGenerator.cs @@ -57,7 +57,7 @@ public virtual ResultSetMapping AppendBulkInsertOperation( o => !o.IsKey || !o.IsRead - || o.Property?.GetSqlServerValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn)) + || o.Property?.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.IdentityColumn)) { return AppendInsertOperation(commandStringBuilder, modificationCommands[0], commandPosition); } @@ -68,7 +68,7 @@ public virtual ResultSetMapping AppendBulkInsertOperation( var defaultValuesOnly = writeOperations.Count == 0; var nonIdentityOperations = modificationCommands[0].ColumnModifications - .Where(o => o.Property?.GetSqlServerValueGenerationStrategy() != SqlServerValueGenerationStrategy.IdentityColumn) + .Where(o => o.Property?.GetValueGenerationStrategy() != SqlServerValueGenerationStrategy.IdentityColumn) .ToList(); if (defaultValuesOnly) @@ -103,7 +103,7 @@ public virtual ResultSetMapping AppendBulkInsertOperation( } if (modificationCommands[0].Entries.SelectMany(e => e.EntityType.GetAllBaseTypesInclusive()) - .Any(e => e.GetSqlServerIsMemoryOptimized())) + .Any(e => e.IsMemoryOptimized())) { if (!nonIdentityOperations.Any(o => o.IsRead && o.IsKey)) { diff --git a/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorCache.cs b/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorCache.cs index 4644a759d6e..95a37a4f14f 100644 --- a/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorCache.cs +++ b/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorCache.cs @@ -48,7 +48,7 @@ public virtual SqlServerSequenceValueGeneratorState GetOrAddSequenceState( IProperty property, IRelationalConnection connection) { - var sequence = property.FindSqlServerHiLoSequence(); + var sequence = property.FindHiLoSequence(); Debug.Assert(sequence != null); diff --git a/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorSelector.cs b/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorSelector.cs index e0300389a55..d9ebd3af1c8 100644 --- a/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorSelector.cs +++ b/src/EFCore.SqlServer/ValueGeneration/Internal/SqlServerValueGeneratorSelector.cs @@ -74,7 +74,7 @@ public override ValueGenerator Select(IProperty property, IEntityType entityType Check.NotNull(entityType, nameof(entityType)); return property.GetValueGeneratorFactory() == null - && property.GetSqlServerValueGenerationStrategy() == SqlServerValueGenerationStrategy.SequenceHiLo + && property.GetValueGenerationStrategy() == SqlServerValueGenerationStrategy.SequenceHiLo ? _sequenceFactory.Create( property, Cache.GetOrAddSequenceState(property, _connection), diff --git a/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyBuilderExtensions.cs b/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyBuilderExtensions.cs index 226dac15c90..8afee6aa59e 100644 --- a/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyBuilderExtensions.cs +++ b/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyBuilderExtensions.cs @@ -25,7 +25,7 @@ public static PropertyBuilder HasSrid([NotNull] this PropertyBuilder propertyBui { Check.NotNull(propertyBuilder, nameof(propertyBuilder)); - propertyBuilder.Metadata.SetSqliteSrid(srid); + propertyBuilder.Metadata.SetSrid(srid); return propertyBuilder; } @@ -58,7 +58,7 @@ public static IConventionPropertyBuilder HasSrid( { if (propertyBuilder.CanSetSrid(srid, fromDataAnnotation)) { - propertyBuilder.Metadata.SetSqliteSrid(srid, fromDataAnnotation); + propertyBuilder.Metadata.SetSrid(srid, fromDataAnnotation); return propertyBuilder; } @@ -99,7 +99,7 @@ public static IConventionPropertyBuilder HasSpatialDimension( { if (propertyBuilder.CanSetSpatialDimension(dimension, fromDataAnnotation)) { - propertyBuilder.Metadata.SetSqliteDimension(dimension, fromDataAnnotation); + propertyBuilder.Metadata.SetSpatialDimension(dimension, fromDataAnnotation); return propertyBuilder; } diff --git a/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyExtensions.cs b/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyExtensions.cs index 3235fe67054..4efa81b10f8 100644 --- a/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyExtensions.cs +++ b/src/EFCore.Sqlite.Core/Extensions/SqlitePropertyExtensions.cs @@ -18,7 +18,7 @@ public static class SqlitePropertyExtensions /// /// The property. /// The SRID to use when creating a column for this property. - public static int? GetSqliteSrid([NotNull] this IProperty property) + public static int? GetSrid([NotNull] this IProperty property) => (int?)property[SqliteAnnotationNames.Srid]; /// @@ -26,7 +26,7 @@ public static class SqlitePropertyExtensions /// /// The property. /// The SRID. - public static void SetSqliteSrid([NotNull] this IMutableProperty property, int? value) + public static void SetSrid([NotNull] this IMutableProperty property, int? value) => property.SetOrRemoveAnnotation(SqliteAnnotationNames.Srid, value); /// @@ -35,7 +35,7 @@ public static void SetSqliteSrid([NotNull] this IMutableProperty property, int? /// The property. /// The SRID. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqliteSrid([NotNull] this IConventionProperty property, int? value, bool fromDataAnnotation = false) + public static void SetSrid([NotNull] this IConventionProperty property, int? value, bool fromDataAnnotation = false) => property.SetOrRemoveAnnotation(SqliteAnnotationNames.Srid, value, fromDataAnnotation); /// @@ -43,7 +43,7 @@ public static void SetSqliteSrid([NotNull] this IConventionProperty property, in /// /// The property. /// The for the column SRID. - public static ConfigurationSource? GetSqliteSridConfigurationSource([NotNull] this IConventionProperty property) + public static ConfigurationSource? GetSridConfigurationSource([NotNull] this IConventionProperty property) => property.FindAnnotation(SqliteAnnotationNames.Srid)?.GetConfigurationSource(); /// @@ -51,7 +51,7 @@ public static void SetSqliteSrid([NotNull] this IConventionProperty property, in /// /// The property. /// The dimension to use when creating a column for this property. - public static string GetSqliteDimension([NotNull] this IProperty property) + public static string GetSpatialDimension([NotNull] this IProperty property) => (string)property[SqliteAnnotationNames.Dimension]; /// @@ -59,7 +59,7 @@ public static string GetSqliteDimension([NotNull] this IProperty property) /// /// The property. /// The dimension. - public static void SetSqliteDimension([NotNull] this IMutableProperty property, [CanBeNull] string value) + public static void SetSpatialDimension([NotNull] this IMutableProperty property, [CanBeNull] string value) => property.SetOrRemoveAnnotation(SqliteAnnotationNames.Dimension, value); /// @@ -68,7 +68,7 @@ public static void SetSqliteDimension([NotNull] this IMutableProperty property, /// The property. /// The dimension. /// Indicates whether the configuration was specified using a data annotation. - public static void SetSqliteDimension( + public static void SetSpatialDimension( [NotNull] this IConventionProperty property, [CanBeNull] string value, bool fromDataAnnotation = false) => property.SetOrRemoveAnnotation(SqliteAnnotationNames.Dimension, value, fromDataAnnotation); @@ -77,7 +77,7 @@ public static void SetSqliteDimension( /// /// The property. /// The for the column dimension. - public static ConfigurationSource? GetSqliteDimensionConfigurationSource([NotNull] this IConventionProperty property) + public static ConfigurationSource? GetSpatialDimensionConfigurationSource([NotNull] this IConventionProperty property) => property.FindAnnotation(SqliteAnnotationNames.Dimension)?.GetConfigurationSource(); } } diff --git a/src/EFCore.Sqlite.Core/Migrations/Internal/SqliteMigrationsAnnotationProvider.cs b/src/EFCore.Sqlite.Core/Migrations/Internal/SqliteMigrationsAnnotationProvider.cs index b844fed7e62..43a00d4d1f4 100644 --- a/src/EFCore.Sqlite.Core/Migrations/Internal/SqliteMigrationsAnnotationProvider.cs +++ b/src/EFCore.Sqlite.Core/Migrations/Internal/SqliteMigrationsAnnotationProvider.cs @@ -70,13 +70,13 @@ public override IEnumerable For(IProperty property) yield return new Annotation(SqliteAnnotationNames.Autoincrement, true); } - var srid = property.GetSqliteSrid(); + var srid = property.GetSrid(); if (srid != null) { yield return new Annotation(SqliteAnnotationNames.Srid, srid); } - var dimension = property.GetSqliteDimension(); + var dimension = property.GetSpatialDimension(); if (dimension != null) { yield return new Annotation(SqliteAnnotationNames.Dimension, dimension); diff --git a/src/EFCore.Sqlite.NTS/Extensions/SqliteNetTopologySuitePropertyBuilderExtensions.cs b/src/EFCore.Sqlite.NTS/Extensions/SqliteNetTopologySuitePropertyBuilderExtensions.cs index 83bfec94ca3..dcbfd03dac5 100644 --- a/src/EFCore.Sqlite.NTS/Extensions/SqliteNetTopologySuitePropertyBuilderExtensions.cs +++ b/src/EFCore.Sqlite.NTS/Extensions/SqliteNetTopologySuitePropertyBuilderExtensions.cs @@ -37,7 +37,7 @@ public static PropertyBuilder HasSpatialDimension( dimension += "M"; } - propertyBuilder.Metadata.SetSqliteDimension(dimension); + propertyBuilder.Metadata.SetSpatialDimension(dimension); return propertyBuilder; } diff --git a/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs index 285e6f9e8b3..4153f45ab76 100644 --- a/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/DataAnnotationSqlServerTest.cs @@ -119,7 +119,7 @@ public override ModelBuilder DatabaseGeneratedOption_configures_the_property_cor var modelBuilder = base.DatabaseGeneratedOption_configures_the_property_correctly(); var identity = modelBuilder.Model.FindEntityType(typeof(GeneratedEntity)).FindProperty(nameof(GeneratedEntity.Identity)); - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, identity.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, identity.GetValueGenerationStrategy()); return modelBuilder; } @@ -131,13 +131,13 @@ public override ModelBuilder DatabaseGeneratedOption_Identity_does_not_throw_on_ var entity = modelBuilder.Model.FindEntityType(typeof(GeneratedEntityNonInteger)); var stringProperty = entity.FindProperty(nameof(GeneratedEntityNonInteger.String)); - Assert.Equal(SqlServerValueGenerationStrategy.None, stringProperty.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, stringProperty.GetValueGenerationStrategy()); var dateTimeProperty = entity.FindProperty(nameof(GeneratedEntityNonInteger.DateTime)); - Assert.Equal(SqlServerValueGenerationStrategy.None, dateTimeProperty.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, dateTimeProperty.GetValueGenerationStrategy()); var guidProperty = entity.FindProperty(nameof(GeneratedEntityNonInteger.Guid)); - Assert.Equal(SqlServerValueGenerationStrategy.None, guidProperty.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, guidProperty.GetValueGenerationStrategy()); return modelBuilder; } diff --git a/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs b/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs index e8d5c8ea3a2..0df01c755ce 100644 --- a/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs +++ b/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs @@ -417,7 +417,7 @@ protected virtual void ConfigureProperty(IMutableProperty property, string confi property.SetComputedColumnSql(value); break; case "SqlServerValueGenerationStrategy": - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); break; default: throw new NotImplementedException(); diff --git a/test/EFCore.SqlServer.Tests/Metadata/Conventions/SqlServerMemoryOptimizedTablesConventionTest.cs b/test/EFCore.SqlServer.Tests/Metadata/Conventions/SqlServerMemoryOptimizedTablesConventionTest.cs index 73784762c30..a5bff9465c8 100644 --- a/test/EFCore.SqlServer.Tests/Metadata/Conventions/SqlServerMemoryOptimizedTablesConventionTest.cs +++ b/test/EFCore.SqlServer.Tests/Metadata/Conventions/SqlServerMemoryOptimizedTablesConventionTest.cs @@ -18,8 +18,8 @@ public void Keys_and_indexes_are_nonclustered_for_memory_optimized_tables(bool o modelBuilder.Entity(); - Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetKeys().All(k => k.GetSqlServerIsClustered() == null)); - Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetIndexes().All(k => k.GetSqlServerIsClustered() == null)); + Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetKeys().All(k => k.IsClustered() == null)); + Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetIndexes().All(k => k.IsClustered() == null)); if (obsolete) { @@ -40,8 +40,8 @@ public void Keys_and_indexes_are_nonclustered_for_memory_optimized_tables(bool o }); modelBuilder.Entity().HasIndex(o => o.CustomerId); - Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetKeys().All(k => k.GetSqlServerIsClustered() == false)); - Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetIndexes().All(k => k.GetSqlServerIsClustered() == false)); + Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetKeys().All(k => k.IsClustered() == false)); + Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetIndexes().All(k => k.IsClustered() == false)); if (obsolete) { @@ -54,8 +54,8 @@ public void Keys_and_indexes_are_nonclustered_for_memory_optimized_tables(bool o modelBuilder.Entity().IsMemoryOptimized(false); } - Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetKeys().All(k => k.GetSqlServerIsClustered() == null)); - Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetIndexes().All(k => k.GetSqlServerIsClustered() == null)); + Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetKeys().All(k => k.IsClustered() == null)); + Assert.True(modelBuilder.Model.FindEntityType(typeof(Order)).GetIndexes().All(k => k.IsClustered() == null)); } private class Order diff --git a/test/EFCore.SqlServer.Tests/Metadata/SqlServerBuilderExtensionsTest.cs b/test/EFCore.SqlServer.Tests/Metadata/SqlServerBuilderExtensionsTest.cs index c74ba691d2e..a042c7e563f 100644 --- a/test/EFCore.SqlServer.Tests/Metadata/SqlServerBuilderExtensionsTest.cs +++ b/test/EFCore.SqlServer.Tests/Metadata/SqlServerBuilderExtensionsTest.cs @@ -26,7 +26,7 @@ public void Setting_column_default_value_does_not_set_identity_column() var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Id)); - Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); } @@ -43,7 +43,7 @@ public void Setting_column_default_value_sql_does_not_set_identity_column() var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Id)); - Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); } @@ -87,7 +87,7 @@ public void Can_set_MemoryOptimized(bool obsolete) var entityType = modelBuilder.Model.FindEntityType(typeof(Customer)); - Assert.True(entityType.GetSqlServerIsMemoryOptimized()); + Assert.True(entityType.IsMemoryOptimized()); if (obsolete) { @@ -104,7 +104,7 @@ public void Can_set_MemoryOptimized(bool obsolete) .IsMemoryOptimized(false); } - Assert.False(entityType.GetSqlServerIsMemoryOptimized()); + Assert.False(entityType.IsMemoryOptimized()); } [ConditionalTheory] @@ -131,7 +131,7 @@ public void Can_set_MemoryOptimized_non_generic(bool obsolete) var entityType = modelBuilder.Model.FindEntityType(typeof(Customer)); - Assert.True(entityType.GetSqlServerIsMemoryOptimized()); + Assert.True(entityType.IsMemoryOptimized()); if (obsolete) { @@ -148,7 +148,7 @@ public void Can_set_MemoryOptimized_non_generic(bool obsolete) .IsMemoryOptimized(false); } - Assert.False(entityType.GetSqlServerIsMemoryOptimized()); + Assert.False(entityType.IsMemoryOptimized()); } [ConditionalTheory] @@ -177,7 +177,7 @@ public void Can_set_index_clustering(bool obsolete) var index = modelBuilder.Model.FindEntityType(typeof(Customer)).GetIndexes().Single(); - Assert.True(index.GetSqlServerIsClustered().Value); + Assert.True(index.IsClustered().Value); } [ConditionalTheory] @@ -206,7 +206,7 @@ public void Can_set_key_clustering(bool obsolete) var key = modelBuilder.Model.FindEntityType(typeof(Customer)).FindPrimaryKey(); - Assert.True(key.GetSqlServerIsClustered().Value); + Assert.True(key.IsClustered().Value); } [ConditionalTheory] @@ -235,9 +235,9 @@ public void Can_set_index_include(bool obsolete) var index = modelBuilder.Model.FindEntityType(typeof(Customer)).GetIndexes().Single(); - Assert.NotNull(index.GetSqlServerIncludeProperties()); + Assert.NotNull(index.GetIncludeProperties()); Assert.Collection( - index.GetSqlServerIncludeProperties(), + index.GetIncludeProperties(), c => Assert.Equal(nameof(Customer.Offset), c)); } @@ -270,9 +270,9 @@ public void Can_set_index_include_after_unique_using_generic_builder(bool obsole var index = modelBuilder.Model.FindEntityType(typeof(Customer)).GetIndexes().Single(); Assert.True(index.IsUnique); - Assert.NotNull(index.GetSqlServerIncludeProperties()); + Assert.NotNull(index.GetIncludeProperties()); Assert.Collection( - index.GetSqlServerIncludeProperties(), + index.GetIncludeProperties(), c => Assert.Equal(nameof(Customer.Offset), c)); } @@ -309,9 +309,9 @@ public void Can_set_index_include_after_annotation_using_generic_builder(bool ob Assert.NotNull(annotation); Assert.True(annotation.Value as bool?); - Assert.NotNull(index.GetSqlServerIncludeProperties()); + Assert.NotNull(index.GetIncludeProperties()); Assert.Collection( - index.GetSqlServerIncludeProperties(), + index.GetIncludeProperties(), c => Assert.Equal(nameof(Customer.Offset), c)); } @@ -341,9 +341,9 @@ public void Can_set_index_include_non_generic(bool obsolete) var index = modelBuilder.Model.FindEntityType(typeof(Customer)).GetIndexes().Single(); - Assert.NotNull(index.GetSqlServerIncludeProperties()); + Assert.NotNull(index.GetIncludeProperties()); Assert.Collection( - index.GetSqlServerIncludeProperties(), + index.GetIncludeProperties(), c => Assert.Equal(nameof(Customer.Offset), c)); } @@ -373,7 +373,7 @@ public void Can_set_index_online(bool obsolete) var index = modelBuilder.Model.FindEntityType(typeof(Customer)).GetIndexes().Single(); - Assert.True(index.GetSqlServerIsCreatedOnline()); + Assert.True(index.IsCreatedOnline()); } [ConditionalTheory] @@ -402,7 +402,7 @@ public void Can_set_index_online_non_generic(bool obsolete) var index = modelBuilder.Model.FindEntityType(typeof(Customer)).GetIndexes().Single(); - Assert.True(index.GetSqlServerIsCreatedOnline()); + Assert.True(index.IsCreatedOnline()); } [ConditionalTheory] @@ -426,9 +426,9 @@ public void Can_set_sequences_for_model(bool obsolete) var relationalExtensions = modelBuilder.Model; var sqlServerExtensions = modelBuilder.Model; - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetSqlServerValueGenerationStrategy()); - Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, sqlServerExtensions.GetSqlServerHiLoSequenceName()); - Assert.Null(sqlServerExtensions.GetSqlServerHiLoSequenceSchema()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetValueGenerationStrategy()); + Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, sqlServerExtensions.GetHiLoSequenceName()); + Assert.Null(sqlServerExtensions.GetHiLoSequenceSchema()); Assert.NotNull(relationalExtensions.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); Assert.NotNull(sqlServerExtensions.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); @@ -455,9 +455,9 @@ public void Can_set_sequences_with_name_for_model(bool obsolete) var relationalExtensions = modelBuilder.Model; var sqlServerExtensions = modelBuilder.Model; - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetSqlServerValueGenerationStrategy()); - Assert.Equal("Snook", sqlServerExtensions.GetSqlServerHiLoSequenceName()); - Assert.Null(sqlServerExtensions.GetSqlServerHiLoSequenceSchema()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetValueGenerationStrategy()); + Assert.Equal("Snook", sqlServerExtensions.GetHiLoSequenceName()); + Assert.Null(sqlServerExtensions.GetHiLoSequenceSchema()); Assert.NotNull(relationalExtensions.FindSequence("Snook")); @@ -493,9 +493,9 @@ public void Can_set_sequences_with_schema_and_name_for_model(bool obsolete) var relationalExtensions = modelBuilder.Model; var sqlServerExtensions = modelBuilder.Model; - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetSqlServerValueGenerationStrategy()); - Assert.Equal("Snook", sqlServerExtensions.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", sqlServerExtensions.GetSqlServerHiLoSequenceSchema()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetValueGenerationStrategy()); + Assert.Equal("Snook", sqlServerExtensions.GetHiLoSequenceName()); + Assert.Equal("Tasty", sqlServerExtensions.GetHiLoSequenceSchema()); Assert.NotNull(relationalExtensions.FindSequence("Snook", "Tasty")); @@ -537,9 +537,9 @@ public void Can_set_use_of_existing_relational_sequence_for_model(bool obsolete) var relationalExtensions = modelBuilder.Model; var sqlServerExtensions = modelBuilder.Model; - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetSqlServerValueGenerationStrategy()); - Assert.Equal("Snook", sqlServerExtensions.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", sqlServerExtensions.GetSqlServerHiLoSequenceSchema()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetValueGenerationStrategy()); + Assert.Equal("Snook", sqlServerExtensions.GetHiLoSequenceName()); + Assert.Equal("Tasty", sqlServerExtensions.GetHiLoSequenceSchema()); ValidateSchemaNamedSpecificSequence(relationalExtensions.FindSequence("Snook", "Tasty")); ValidateSchemaNamedSpecificSequence(sqlServerExtensions.FindSequence("Snook", "Tasty")); @@ -573,9 +573,9 @@ public void Can_set_use_of_existing_SQL_sequence_for_model(bool obsolete) var relationalExtensions = modelBuilder.Model; var sqlServerExtensions = modelBuilder.Model; - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetSqlServerValueGenerationStrategy()); - Assert.Equal("Snook", sqlServerExtensions.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", sqlServerExtensions.GetSqlServerHiLoSequenceSchema()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, sqlServerExtensions.GetValueGenerationStrategy()); + Assert.Equal("Snook", sqlServerExtensions.GetHiLoSequenceName()); + Assert.Equal("Tasty", sqlServerExtensions.GetHiLoSequenceSchema()); ValidateSchemaNamedSpecificSequence(relationalExtensions.FindSequence("Snook", "Tasty")); ValidateSchemaNamedSpecificSequence(sqlServerExtensions.FindSequence("Snook", "Tasty")); @@ -612,9 +612,9 @@ public void Can_set_identities_for_model(bool obsolete) var model = modelBuilder.Model; - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, model.GetSqlServerValueGenerationStrategy()); - Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, model.GetSqlServerHiLoSequenceName()); - Assert.Null(model.GetSqlServerHiLoSequenceSchema()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, model.GetValueGenerationStrategy()); + Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, model.GetHiLoSequenceName()); + Assert.Null(model.GetHiLoSequenceSchema()); Assert.Null(model.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); } @@ -648,19 +648,19 @@ public void Setting_SqlServer_identities_for_model_is_lower_priority_than_relati var model = modelBuilder.Model; var idProperty = model.FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Id)); - Assert.Equal(SqlServerValueGenerationStrategy.None, idProperty.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, idProperty.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, idProperty.ValueGenerated); Assert.Equal(1, idProperty.GetDefaultValue()); Assert.Equal(1, idProperty.GetDefaultValue()); var nameProperty = model.FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Name)); - Assert.Equal(SqlServerValueGenerationStrategy.None, nameProperty.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, nameProperty.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAddOrUpdate, nameProperty.ValueGenerated); Assert.Equal("Default", nameProperty.GetComputedColumnSql()); Assert.Equal("Default", nameProperty.GetComputedColumnSql()); var offsetProperty = model.FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Offset)); - Assert.Equal(SqlServerValueGenerationStrategy.None, offsetProperty.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, offsetProperty.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, offsetProperty.ValueGenerated); Assert.Equal("Now", offsetProperty.GetDefaultValueSql()); Assert.Equal("Now", offsetProperty.GetDefaultValueSql()); @@ -693,9 +693,9 @@ public void Can_set_sequence_for_property(bool obsolete) var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, property.GetSqlServerHiLoSequenceName()); + Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, property.GetHiLoSequenceName()); Assert.NotNull(model.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); Assert.NotNull(model.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); @@ -728,10 +728,10 @@ public void Can_set_sequences_with_name_for_property(bool obsolete) var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal("Snook", property.GetSqlServerHiLoSequenceName()); - Assert.Null(property.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Snook", property.GetHiLoSequenceName()); + Assert.Null(property.GetHiLoSequenceSchema()); Assert.NotNull(model.FindSequence("Snook")); @@ -773,10 +773,10 @@ public void Can_set_sequences_with_schema_and_name_for_property(bool obsolete) var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal("Snook", property.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", property.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Snook", property.GetHiLoSequenceName()); + Assert.Equal("Tasty", property.GetHiLoSequenceSchema()); Assert.NotNull(model.FindSequence("Snook", "Tasty")); @@ -824,10 +824,10 @@ public void Can_set_use_of_existing_relational_sequence_for_property(bool obsole var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal("Snook", property.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", property.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Snook", property.GetHiLoSequenceName()); + Assert.Equal("Tasty", property.GetHiLoSequenceSchema()); ValidateSchemaNamedSpecificSequence(model.FindSequence("Snook", "Tasty")); ValidateSchemaNamedSpecificSequence(model.FindSequence("Snook", "Tasty")); @@ -862,10 +862,10 @@ public void Can_set_use_of_existing_relational_sequence_for_property_using_neste var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal("Snook", property.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", property.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Snook", property.GetHiLoSequenceName()); + Assert.Equal("Tasty", property.GetHiLoSequenceSchema()); ValidateSchemaNamedSpecificSequence(model.FindSequence("Snook", "Tasty")); ValidateSchemaNamedSpecificSequence(model.FindSequence("Snook", "Tasty")); @@ -905,10 +905,10 @@ public void Can_set_use_of_existing_SQL_sequence_for_property(bool obsolete) var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal("Snook", property.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", property.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Snook", property.GetHiLoSequenceName()); + Assert.Equal("Tasty", property.GetHiLoSequenceSchema()); ValidateSchemaNamedSpecificSequence(model.FindSequence("Snook", "Tasty")); } @@ -950,10 +950,10 @@ public void Can_set_use_of_existing_SQL_sequence_for_property_using_nested_closu var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal("Snook", property.GetSqlServerHiLoSequenceName()); - Assert.Equal("Tasty", property.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Snook", property.GetHiLoSequenceName()); + Assert.Equal("Tasty", property.GetHiLoSequenceSchema()); ValidateSchemaNamedSpecificSequence(model.FindSequence("Snook", "Tasty")); } @@ -985,11 +985,11 @@ public void Can_set_identities_for_property(bool obsolete) var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal(1, property.GetSqlServerIdentitySeed()); - Assert.Equal(1, property.GetSqlServerIdentityIncrement()); - Assert.Null(property.GetSqlServerHiLoSequenceName()); + Assert.Equal(1, property.GetIdentitySeed()); + Assert.Equal(1, property.GetIdentityIncrement()); + Assert.Null(property.GetHiLoSequenceName()); Assert.Null(model.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); Assert.Null(model.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); @@ -1022,11 +1022,11 @@ public void Can_set_identities_with_seed_and_identity_for_property(bool obsolete var model = modelBuilder.Model; var property = model.FindEntityType(typeof(Customer)).FindProperty("Id"); - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - Assert.Equal(100, property.GetSqlServerIdentitySeed()); - Assert.Equal(5, property.GetSqlServerIdentityIncrement()); - Assert.Null(property.GetSqlServerHiLoSequenceName()); + Assert.Equal(100, property.GetIdentitySeed()); + Assert.Equal(5, property.GetIdentityIncrement()); + Assert.Null(property.GetHiLoSequenceName()); Assert.Null(model.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); Assert.Null(model.FindSequence(SqlServerModelExtensions.DefaultHiLoSequenceName)); diff --git a/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs b/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs index 02ffac84273..45cde596910 100644 --- a/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs +++ b/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs @@ -24,16 +24,16 @@ public void Can_access_model() Assert.NotNull(builder .HasValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo)); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, builder.Metadata.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, builder.Metadata.GetValueGenerationStrategy()); Assert.NotNull(builder .HasValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn, fromDataAnnotation: true)); Assert.Equal( - SqlServerValueGenerationStrategy.IdentityColumn, builder.Metadata.GetSqlServerValueGenerationStrategy()); + SqlServerValueGenerationStrategy.IdentityColumn, builder.Metadata.GetValueGenerationStrategy()); Assert.Null(builder .HasValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo)); - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, builder.Metadata.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, builder.Metadata.GetValueGenerationStrategy()); Assert.Equal( 1, builder.Metadata.GetAnnotations().Count( @@ -46,13 +46,13 @@ public void Can_access_entity_type() var typeBuilder = CreateBuilder().Entity(typeof(Splot)); Assert.NotNull(typeBuilder.IsMemoryOptimized(true)); - Assert.True(typeBuilder.Metadata.GetSqlServerIsMemoryOptimized()); + Assert.True(typeBuilder.Metadata.IsMemoryOptimized()); Assert.NotNull(typeBuilder.IsMemoryOptimized(false, fromDataAnnotation: true)); - Assert.False(typeBuilder.Metadata.GetSqlServerIsMemoryOptimized()); + Assert.False(typeBuilder.Metadata.IsMemoryOptimized()); Assert.Null(typeBuilder.IsMemoryOptimized(true)); - Assert.False(typeBuilder.Metadata.GetSqlServerIsMemoryOptimized()); + Assert.False(typeBuilder.Metadata.IsMemoryOptimized()); Assert.Equal( 1, typeBuilder.Metadata.GetAnnotations().Count( @@ -67,13 +67,13 @@ public void Can_access_property() .Property(typeof(int), "Id"); Assert.NotNull(propertyBuilder.HasHiLoSequence("Splew", null)); - Assert.Equal("Splew", propertyBuilder.Metadata.GetSqlServerHiLoSequenceName()); + Assert.Equal("Splew", propertyBuilder.Metadata.GetHiLoSequenceName()); Assert.NotNull(propertyBuilder.HasHiLoSequence("Splow", null, fromDataAnnotation: true)); - Assert.Equal("Splow", propertyBuilder.Metadata.GetSqlServerHiLoSequenceName()); + Assert.Equal("Splow", propertyBuilder.Metadata.GetHiLoSequenceName()); Assert.Null(propertyBuilder.HasHiLoSequence("Splod", null)); - Assert.Equal("Splow", propertyBuilder.Metadata.GetSqlServerHiLoSequenceName()); + Assert.Equal("Splow", propertyBuilder.Metadata.GetHiLoSequenceName()); Assert.Equal( 1, propertyBuilder.Metadata.GetAnnotations().Count( @@ -125,13 +125,13 @@ public void Can_access_key() var keyBuilder = entityTypeBuilder.HasKey(new[] { idProperty }); Assert.NotNull(keyBuilder.IsClustered(true)); - Assert.True(keyBuilder.Metadata.GetSqlServerIsClustered()); + Assert.True(keyBuilder.Metadata.IsClustered()); Assert.NotNull(keyBuilder.IsClustered(false, fromDataAnnotation: true)); - Assert.False(keyBuilder.Metadata.GetSqlServerIsClustered()); + Assert.False(keyBuilder.Metadata.IsClustered()); Assert.Null(keyBuilder.IsClustered(true)); - Assert.False(keyBuilder.Metadata.GetSqlServerIsClustered()); + Assert.False(keyBuilder.Metadata.IsClustered()); Assert.Equal( 1, keyBuilder.Metadata.GetAnnotations().Count( @@ -158,7 +158,7 @@ public void Can_access_index(bool obsolete) { Assert.NotNull(indexBuilder.IsClustered(true)); } - Assert.True(indexBuilder.Metadata.GetSqlServerIsClustered()); + Assert.True(indexBuilder.Metadata.IsClustered()); if (obsolete) { @@ -170,7 +170,7 @@ public void Can_access_index(bool obsolete) { Assert.NotNull(indexBuilder.IsClustered(false, fromDataAnnotation: true)); } - Assert.False(indexBuilder.Metadata.GetSqlServerIsClustered()); + Assert.False(indexBuilder.Metadata.IsClustered()); if (obsolete) @@ -183,7 +183,7 @@ public void Can_access_index(bool obsolete) { Assert.Null(indexBuilder.IsClustered(true)); } - Assert.False(indexBuilder.Metadata.GetSqlServerIsClustered()); + Assert.False(indexBuilder.Metadata.IsClustered()); Assert.Equal( 1, indexBuilder.Metadata.GetAnnotations().Count( diff --git a/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataExtensionsTest.cs b/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataExtensionsTest.cs index dbb73f98045..3eca4950dc9 100644 --- a/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataExtensionsTest.cs +++ b/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataExtensionsTest.cs @@ -76,15 +76,15 @@ public void Can_get_and_set_index_clustering() .HasIndex(e => e.Id) .Metadata; - Assert.Null(index.GetSqlServerIsClustered()); + Assert.Null(index.IsClustered()); - index.SetSqlServerIsClustered(true); + index.SetIsClustered(true); - Assert.True(index.GetSqlServerIsClustered().Value); + Assert.True(index.IsClustered().Value); - index.SetSqlServerIsClustered(null); + index.SetIsClustered(null); - Assert.Null(index.GetSqlServerIsClustered()); + Assert.Null(index.IsClustered()); } [ConditionalFact] @@ -97,15 +97,15 @@ public void Can_get_and_set_key_clustering() .HasKey(e => e.Id) .Metadata; - Assert.Null(key.GetSqlServerIsClustered()); + Assert.Null(key.IsClustered()); - key.SetSqlServerIsClustered(true); + key.SetIsClustered(true); - Assert.True(key.GetSqlServerIsClustered().Value); + Assert.True(key.IsClustered().Value); - key.SetSqlServerIsClustered(null); + key.SetIsClustered(null); - Assert.Null(key.GetSqlServerIsClustered()); + Assert.Null(key.IsClustered()); } [ConditionalFact] @@ -254,15 +254,15 @@ public void Can_get_and_set_value_generation_on_model() var modelBuilder = GetModelBuilder(); var model = modelBuilder.Model; - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, model.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, model.GetValueGenerationStrategy()); - model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, model.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, model.GetValueGenerationStrategy()); - model.SetSqlServerValueGenerationStrategy(null); + model.SetValueGenerationStrategy(null); - Assert.Null(model.GetSqlServerValueGenerationStrategy()); + Assert.Null(model.GetValueGenerationStrategy()); } [ConditionalFact] @@ -271,13 +271,13 @@ public void Can_get_and_set_default_sequence_name_on_model() var modelBuilder = GetModelBuilder(); var model = modelBuilder.Model; - model.SetSqlServerHiLoSequenceName("Tasty.Snook"); + model.SetHiLoSequenceName("Tasty.Snook"); - Assert.Equal("Tasty.Snook", model.GetSqlServerHiLoSequenceName()); + Assert.Equal("Tasty.Snook", model.GetHiLoSequenceName()); - model.SetSqlServerHiLoSequenceName(null); + model.SetHiLoSequenceName(null); - Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, model.GetSqlServerHiLoSequenceName()); + Assert.Equal(SqlServerModelExtensions.DefaultHiLoSequenceName, model.GetHiLoSequenceName()); } [ConditionalFact] @@ -286,39 +286,39 @@ public void Can_get_and_set_default_sequence_schema_on_model() var modelBuilder = GetModelBuilder(); var model = modelBuilder.Model; - Assert.Null(model.GetSqlServerHiLoSequenceSchema()); + Assert.Null(model.GetHiLoSequenceSchema()); - model.SetSqlServerHiLoSequenceSchema("Tasty.Snook"); + model.SetHiLoSequenceSchema("Tasty.Snook"); - Assert.Equal("Tasty.Snook", model.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Tasty.Snook", model.GetHiLoSequenceSchema()); - model.SetSqlServerHiLoSequenceSchema(null); + model.SetHiLoSequenceSchema(null); - Assert.Null(model.GetSqlServerHiLoSequenceSchema()); + Assert.Null(model.GetHiLoSequenceSchema()); } [ConditionalFact] public void Can_get_and_set_value_generation_on_property() { var modelBuilder = GetModelBuilder(); - modelBuilder.Model.SetSqlServerValueGenerationStrategy(null); + modelBuilder.Model.SetValueGenerationStrategy(null); var property = modelBuilder .Entity() .Property(e => e.Id) .Metadata; - Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); - property.SetSqlServerValueGenerationStrategy(null); + property.SetValueGenerationStrategy(null); - Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetValueGenerationStrategy()); Assert.Equal(ValueGenerated.OnAdd, property.ValueGenerated); } @@ -332,15 +332,15 @@ public void Can_get_and_set_value_generation_on_nullable_property() .Property(e => e.NullableInt).ValueGeneratedOnAdd() .Metadata; - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetValueGenerationStrategy()); - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.SequenceHiLo, property.GetValueGenerationStrategy()); - property.SetSqlServerValueGenerationStrategy(null); + property.SetValueGenerationStrategy(null); - Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetSqlServerValueGenerationStrategy()); + Assert.Equal(SqlServerValueGenerationStrategy.IdentityColumn, property.GetValueGenerationStrategy()); } [ConditionalFact] @@ -356,7 +356,7 @@ public void Throws_setting_sequence_generation_for_invalid_type() Assert.Equal( SqlServerStrings.SequenceBadType("Name", nameof(Customer), "string"), Assert.Throws( - () => property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo)).Message); + () => property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo)).Message); } [ConditionalFact] @@ -372,7 +372,7 @@ public void Throws_setting_identity_generation_for_invalid_type() Assert.Equal( SqlServerStrings.IdentityBadType("Name", nameof(Customer), "string"), Assert.Throws( - () => property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn)).Message); + () => property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn)).Message); } [ConditionalFact] @@ -385,16 +385,16 @@ public void Can_get_and_set_sequence_name_on_property() .Property(e => e.Id) .Metadata; - Assert.Null(property.GetSqlServerHiLoSequenceName()); - Assert.Null(((IProperty)property).GetSqlServerHiLoSequenceName()); + Assert.Null(property.GetHiLoSequenceName()); + Assert.Null(((IProperty)property).GetHiLoSequenceName()); - property.SetSqlServerHiLoSequenceName("Snook"); + property.SetHiLoSequenceName("Snook"); - Assert.Equal("Snook", property.GetSqlServerHiLoSequenceName()); + Assert.Equal("Snook", property.GetHiLoSequenceName()); - property.SetSqlServerHiLoSequenceName(null); + property.SetHiLoSequenceName(null); - Assert.Null(property.GetSqlServerHiLoSequenceName()); + Assert.Null(property.GetHiLoSequenceName()); } [ConditionalFact] @@ -407,15 +407,15 @@ public void Can_get_and_set_sequence_schema_on_property() .Property(e => e.Id) .Metadata; - Assert.Null(property.GetSqlServerHiLoSequenceSchema()); + Assert.Null(property.GetHiLoSequenceSchema()); - property.SetSqlServerHiLoSequenceSchema("Tasty"); + property.SetHiLoSequenceSchema("Tasty"); - Assert.Equal("Tasty", property.GetSqlServerHiLoSequenceSchema()); + Assert.Equal("Tasty", property.GetHiLoSequenceSchema()); - property.SetSqlServerHiLoSequenceSchema(null); + property.SetHiLoSequenceSchema(null); - Assert.Null(property.GetSqlServerHiLoSequenceSchema()); + Assert.Null(property.GetHiLoSequenceSchema()); } [ConditionalFact] @@ -430,20 +430,20 @@ public void TryGetSequence_returns_null_if_property_is_not_configured_for_sequen modelBuilder.Model.AddSequence("DaneelOlivaw"); - Assert.Null(property.FindSqlServerHiLoSequence()); + Assert.Null(property.FindHiLoSequence()); - property.SetSqlServerHiLoSequenceName("DaneelOlivaw"); + property.SetHiLoSequenceName("DaneelOlivaw"); - Assert.Null(property.FindSqlServerHiLoSequence()); + Assert.Null(property.FindHiLoSequence()); - modelBuilder.Model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); - Assert.Null(property.FindSqlServerHiLoSequence()); + Assert.Null(property.FindHiLoSequence()); - modelBuilder.Model.SetSqlServerValueGenerationStrategy(null); - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Model.SetValueGenerationStrategy(null); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn); - Assert.Null(property.FindSqlServerHiLoSequence()); + Assert.Null(property.FindHiLoSequence()); } [ConditionalFact] @@ -458,10 +458,10 @@ public void TryGetSequence_returns_sequence_property_is_marked_for_sequence_gene .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw"); - property.SetSqlServerHiLoSequenceName("DaneelOlivaw"); - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + property.SetHiLoSequenceName("DaneelOlivaw"); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); } [ConditionalFact] @@ -476,10 +476,10 @@ public void TryGetSequence_returns_sequence_property_is_marked_for_default_gener .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw"); - modelBuilder.Model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - property.SetSqlServerHiLoSequenceName("DaneelOlivaw"); + modelBuilder.Model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + property.SetHiLoSequenceName("DaneelOlivaw"); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); } [ConditionalFact] @@ -494,10 +494,10 @@ public void TryGetSequence_returns_sequence_property_is_marked_for_sequence_gene .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw"); - modelBuilder.Model.SetSqlServerHiLoSequenceName("DaneelOlivaw"); - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + modelBuilder.Model.SetHiLoSequenceName("DaneelOlivaw"); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); } [ConditionalFact] @@ -513,10 +513,10 @@ public void .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw"); - modelBuilder.Model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - modelBuilder.Model.SetSqlServerHiLoSequenceName("DaneelOlivaw"); + modelBuilder.Model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + modelBuilder.Model.SetHiLoSequenceName("DaneelOlivaw"); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); } [ConditionalFact] @@ -531,12 +531,12 @@ public void TryGetSequence_with_schema_returns_sequence_property_is_marked_for_s .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw", "R"); - property.SetSqlServerHiLoSequenceName("DaneelOlivaw"); - property.SetSqlServerHiLoSequenceSchema("R"); - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + property.SetHiLoSequenceName("DaneelOlivaw"); + property.SetHiLoSequenceSchema("R"); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); - Assert.Equal("R", property.FindSqlServerHiLoSequence().Schema); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); + Assert.Equal("R", property.FindHiLoSequence().Schema); } [ConditionalFact] @@ -551,12 +551,12 @@ public void TryGetSequence_with_schema_returns_sequence_model_is_marked_for_sequ .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw", "R"); - modelBuilder.Model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - property.SetSqlServerHiLoSequenceName("DaneelOlivaw"); - property.SetSqlServerHiLoSequenceSchema("R"); + modelBuilder.Model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + property.SetHiLoSequenceName("DaneelOlivaw"); + property.SetHiLoSequenceSchema("R"); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); - Assert.Equal("R", property.FindSqlServerHiLoSequence().Schema); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); + Assert.Equal("R", property.FindHiLoSequence().Schema); } [ConditionalFact] @@ -571,12 +571,12 @@ public void TryGetSequence_with_schema_returns_sequence_property_is_marked_for_s .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw", "R"); - modelBuilder.Model.SetSqlServerHiLoSequenceName("DaneelOlivaw"); - modelBuilder.Model.SetSqlServerHiLoSequenceSchema("R"); - property.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + modelBuilder.Model.SetHiLoSequenceName("DaneelOlivaw"); + modelBuilder.Model.SetHiLoSequenceSchema("R"); + property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); - Assert.Equal("R", property.FindSqlServerHiLoSequence().Schema); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); + Assert.Equal("R", property.FindHiLoSequence().Schema); } [ConditionalFact] @@ -591,12 +591,12 @@ public void TryGetSequence_with_schema_returns_sequence_model_is_marked_for_sequ .Metadata; modelBuilder.Model.AddSequence("DaneelOlivaw", "R"); - modelBuilder.Model.SetSqlServerValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); - modelBuilder.Model.SetSqlServerHiLoSequenceName("DaneelOlivaw"); - modelBuilder.Model.SetSqlServerHiLoSequenceSchema("R"); + modelBuilder.Model.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.SequenceHiLo); + modelBuilder.Model.SetHiLoSequenceName("DaneelOlivaw"); + modelBuilder.Model.SetHiLoSequenceSchema("R"); - Assert.Equal("DaneelOlivaw", property.FindSqlServerHiLoSequence().Name); - Assert.Equal("R", property.FindSqlServerHiLoSequence().Schema); + Assert.Equal("DaneelOlivaw", property.FindHiLoSequence().Name); + Assert.Equal("R", property.FindHiLoSequence().Schema); } private static ModelBuilder GetModelBuilder() => SqlServerTestHelpers.Instance.CreateConventionBuilder(); diff --git a/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderGenericTest.cs b/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderGenericTest.cs index 373302e9f18..d0fe2b4b78e 100644 --- a/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderGenericTest.cs +++ b/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderGenericTest.cs @@ -373,10 +373,10 @@ public virtual void Owned_types_can_be_mapped_to_different_tables() Assert.Equal("BT", book.GetTableName()); Assert.Equal("LS", bookOwnership1.DeclaringEntityType.GetSchema()); Assert.Equal("LT", bookOwnership1.DeclaringEntityType.GetTableName()); - Assert.False(bookOwnership1.DeclaringEntityType.GetSqlServerIsMemoryOptimized()); + Assert.False(bookOwnership1.DeclaringEntityType.IsMemoryOptimized()); Assert.Equal("TS", bookOwnership2.DeclaringEntityType.GetSchema()); Assert.Equal("TT", bookOwnership2.DeclaringEntityType.GetTableName()); - Assert.True(bookOwnership2.DeclaringEntityType.GetSqlServerIsMemoryOptimized()); + Assert.True(bookOwnership2.DeclaringEntityType.IsMemoryOptimized()); Assert.Equal("AS2", bookLabel1Ownership1.DeclaringEntityType.GetSchema()); Assert.Equal("AT2", bookLabel1Ownership1.DeclaringEntityType.GetTableName()); Assert.Equal("SS1", bookLabel1Ownership2.DeclaringEntityType.GetSchema()); @@ -445,7 +445,7 @@ public virtual void Owned_type_collections_can_be_mapped_to_different_tables() owned.GetProperties().Select(p => p.GetColumnName())); Assert.Equal(nameof(Order), owned.GetTableName()); Assert.Null(owned.GetSchema()); - Assert.True(owned.GetSqlServerIsMemoryOptimized()); + Assert.True(owned.IsMemoryOptimized()); modelBuilder.Entity().OwnsMany( c => c.Orders, diff --git a/test/EFCore.Sqlite.Tests/Metadata/Builders/SqliteBuilderExtensionsTest.cs b/test/EFCore.Sqlite.Tests/Metadata/Builders/SqliteBuilderExtensionsTest.cs index 28aa5c20a52..c613aad1a2a 100644 --- a/test/EFCore.Sqlite.Tests/Metadata/Builders/SqliteBuilderExtensionsTest.cs +++ b/test/EFCore.Sqlite.Tests/Metadata/Builders/SqliteBuilderExtensionsTest.cs @@ -37,7 +37,7 @@ public void Can_set_srid(bool obsolete) .Property(e => e.Geometry) .Metadata; - Assert.Equal(1, property.GetSqliteSrid()); + Assert.Equal(1, property.GetSrid()); } [ConditionalTheory] @@ -69,7 +69,7 @@ public void Can_set_srid_non_generic(bool obsolete) .Property("Geometry") .Metadata; - Assert.Equal(1, property.GetSqliteSrid()); + Assert.Equal(1, property.GetSrid()); } [ConditionalTheory] @@ -101,7 +101,7 @@ public void Can_set_srid_convention(bool obsolete) .Property(typeof(string), "Geometry") .Metadata; - Assert.Equal(1, property.GetSqliteSrid()); + Assert.Equal(1, property.GetSrid()); } [ConditionalTheory] @@ -133,7 +133,7 @@ public void Can_set_dimension_convention(bool obsolete) .Property(typeof(string), "Geometry") .Metadata; - Assert.Equal("Z", property.GetSqliteDimension()); + Assert.Equal("Z", property.GetSpatialDimension()); } protected virtual ModelBuilder CreateConventionModelBuilder() diff --git a/test/EFCore.Sqlite.Tests/Metadata/SqliteMetadataExtensionsTest.cs b/test/EFCore.Sqlite.Tests/Metadata/SqliteMetadataExtensionsTest.cs index ce40b55e786..55a53d0a164 100644 --- a/test/EFCore.Sqlite.Tests/Metadata/SqliteMetadataExtensionsTest.cs +++ b/test/EFCore.Sqlite.Tests/Metadata/SqliteMetadataExtensionsTest.cs @@ -18,15 +18,15 @@ public void Can_get_and_set_srid() .Property(e => e.Geometry) .Metadata; - Assert.Null(property.GetSqliteSrid()); + Assert.Null(property.GetSrid()); - property.SetSqliteSrid(1); + property.SetSrid(1); - Assert.Equal(1, property.GetSqliteSrid()); + Assert.Equal(1, property.GetSrid()); - property.SetSqliteSrid(null); + property.SetSrid(null); - Assert.Null(property.GetSqliteSrid()); + Assert.Null(property.GetSrid()); } [ConditionalFact] @@ -39,15 +39,15 @@ public void Can_get_and_set_dimension() .Property(e => e.Geometry) .Metadata; - Assert.Null(property.GetSqliteDimension()); + Assert.Null(property.GetSpatialDimension()); - property.SetSqliteDimension("Z"); + property.SetSpatialDimension("Z"); - Assert.Equal("Z", property.GetSqliteDimension()); + Assert.Equal("Z", property.GetSpatialDimension()); - property.SetSqliteDimension(null); + property.SetSpatialDimension(null); - Assert.Null(property.GetSqliteDimension()); + Assert.Null(property.GetSpatialDimension()); } private class Customer