Skip to content

Commit fd57f4a

Browse files
committed
Rename some extension methods so that it doesn't interfere with other providers (namely sql server)
1 parent fd6c2ae commit fd57f4a

12 files changed

Lines changed: 83 additions & 77 deletions

docs/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ To use the latest daily builds from our [Azure DevOps feed](https://bubibubi.vis
3838
</configuration>
3939
```
4040

41+
## Fluent API
42+
43+
In order to be able to be shared with SqlServer (and other providers) the names of some of the Fluent API methods have been made specific to Jet.
44+
45+
* `UseIdentityColumn` -> `UseJetIdentityColumn`
46+
* `UseIdentityColumns` -> `UseJetIdentityColumns`
47+
48+
More may be added in the future
49+
4150
## Further information
4251
More information can be found on our [Wiki](https://www.github.com/bubibubi/EntityFrameworkCore.Jet/wiki).
4352

src/EFCore.Jet/Extensions/JetIndexExtensions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
using System;
12
using System.Collections.Generic;
23
using EntityFrameworkCore.Jet.Metadata.Internal;
34
using JetBrains.Annotations;
5+
using Microsoft.EntityFrameworkCore.Diagnostics;
46
using Microsoft.EntityFrameworkCore.Metadata;
57

68
// ReSharper disable once CheckNamespace
@@ -16,7 +18,7 @@ public static class JetIndexExtensions
1618
/// </summary>
1719
/// <param name="index"> The index. </param>
1820
/// <returns> The included property names, or <c>null</c> if they have not been specified. </returns>
19-
public static IReadOnlyList<string>? GetIncludeProperties([NotNull] this IReadOnlyIndex index)
21+
public static IReadOnlyList<string>? GetJetIncludeProperties([NotNull] this IReadOnlyIndex index)
2022
=> (index is RuntimeIndex)
2123
? throw new InvalidOperationException(CoreStrings.RuntimeModelMissingData)
2224
: (string[]?)index[JetAnnotationNames.Include];
@@ -26,7 +28,7 @@ public static class JetIndexExtensions
2628
/// </summary>
2729
/// <param name="index"> The index. </param>
2830
/// <param name="properties"> The value to set. </param>
29-
public static void SetIncludeProperties([NotNull] this IMutableIndex index, [NotNull] IReadOnlyList<string> properties)
31+
public static void SetJetIncludeProperties([NotNull] this IMutableIndex index, [NotNull] IReadOnlyList<string> properties)
3032
=> index.SetOrRemoveAnnotation(
3133
JetAnnotationNames.Include,
3234
properties);
@@ -37,7 +39,7 @@ public static void SetIncludeProperties([NotNull] this IMutableIndex index, [Not
3739
/// <param name="index"> The index. </param>
3840
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
3941
/// <param name="properties"> The value to set. </param>
40-
public static void SetIncludeProperties(
42+
public static void SetJetIncludeProperties(
4143
[NotNull] this IConventionIndex index, [NotNull] IReadOnlyList<string> properties, bool fromDataAnnotation = false)
4244
=> index.SetOrRemoveAnnotation(
4345
JetAnnotationNames.Include,
@@ -49,7 +51,7 @@ public static void SetIncludeProperties(
4951
/// </summary>
5052
/// <param name="index"> The index. </param>
5153
/// <returns> The <see cref="ConfigurationSource" /> for the included property names. </returns>
52-
public static ConfigurationSource? GetIncludePropertiesConfigurationSource([NotNull] this IConventionIndex index)
54+
public static ConfigurationSource? GetJetIncludePropertiesConfigurationSource([NotNull] this IConventionIndex index)
5355
=> index.FindAnnotation(JetAnnotationNames.Include)?.GetConfigurationSource();
5456
}
5557
}

src/EFCore.Jet/Extensions/JetModelBuilderExtensions.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static class JetModelBuilderExtensions
2424
/// <param name="seed"> The value that is used for the very first row loaded into the table. </param>
2525
/// <param name="increment"> The incremental value that is added to the identity value of the previous row that was loaded. </param>
2626
/// <returns> The same builder instance so that multiple calls can be chained. </returns>
27-
public static ModelBuilder UseIdentityColumns(
27+
public static ModelBuilder UseJetIdentityColumns(
2828
[NotNull] this ModelBuilder modelBuilder,
2929
int seed = 1,
3030
int increment = 1)
@@ -34,8 +34,8 @@ public static ModelBuilder UseIdentityColumns(
3434
var model = modelBuilder.Model;
3535

3636
model.SetValueGenerationStrategy(JetValueGenerationStrategy.IdentityColumn);
37-
model.SetIdentitySeed(seed);
38-
model.SetIdentityIncrement(increment);
37+
model.SetJetIdentitySeed(seed);
38+
model.SetJetIdentityIncrement(increment);
3939

4040
return modelBuilder;
4141
}
@@ -50,12 +50,12 @@ public static ModelBuilder UseIdentityColumns(
5050
/// The same builder instance if the configuration was applied,
5151
/// <c>null</c> otherwise.
5252
/// </returns>
53-
public static IConventionModelBuilder? HasIdentityColumnSeed(
53+
public static IConventionModelBuilder? HasJetIdentityColumnSeed(
5454
[NotNull] this IConventionModelBuilder modelBuilder, int? seed, bool fromDataAnnotation = false)
5555
{
56-
if (modelBuilder.CanSetIdentityColumnSeed(seed, fromDataAnnotation))
56+
if (modelBuilder.CanSetJetIdentityColumnSeed(seed, fromDataAnnotation))
5757
{
58-
modelBuilder.Metadata.SetIdentitySeed(seed, fromDataAnnotation);
58+
modelBuilder.Metadata.SetJetIdentitySeed(seed, fromDataAnnotation);
5959
return modelBuilder;
6060
}
6161

@@ -69,7 +69,7 @@ public static ModelBuilder UseIdentityColumns(
6969
/// <param name="seed"> The value that is used for the very first row loaded into the table. </param>
7070
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
7171
/// <returns> <c>true</c> if the given value can be set as the seed for Jet IDENTITY. </returns>
72-
public static bool CanSetIdentityColumnSeed(
72+
public static bool CanSetJetIdentityColumnSeed(
7373
[NotNull] this IConventionModelBuilder modelBuilder, int? seed, bool fromDataAnnotation = false)
7474
{
7575
Check.NotNull(modelBuilder, nameof(modelBuilder));
@@ -87,12 +87,12 @@ public static bool CanSetIdentityColumnSeed(
8787
/// The same builder instance if the configuration was applied,
8888
/// <c>null</c> otherwise.
8989
/// </returns>
90-
public static IConventionModelBuilder? HasIdentityColumnIncrement(
90+
public static IConventionModelBuilder? HasJetIdentityColumnIncrement(
9191
[NotNull] this IConventionModelBuilder modelBuilder, int? increment, bool fromDataAnnotation = false)
9292
{
93-
if (modelBuilder.CanSetIdentityColumnIncrement(increment, fromDataAnnotation))
93+
if (modelBuilder.CanSetJetIdentityColumnIncrement(increment, fromDataAnnotation))
9494
{
95-
modelBuilder.Metadata.SetIdentityIncrement(increment, fromDataAnnotation);
95+
modelBuilder.Metadata.SetJetIdentityIncrement(increment, fromDataAnnotation);
9696
return modelBuilder;
9797
}
9898

@@ -106,7 +106,7 @@ public static bool CanSetIdentityColumnSeed(
106106
/// <param name="increment"> The incremental value that is added to the identity value of the previous row that was loaded. </param>
107107
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
108108
/// <returns> <c>true</c> if the given value can be set as the default increment for Jet IDENTITY. </returns>
109-
public static bool CanSetIdentityColumnIncrement(
109+
public static bool CanSetJetIdentityColumnIncrement(
110110
[NotNull] this IConventionModelBuilder modelBuilder, int? increment, bool fromDataAnnotation = false)
111111
{
112112
Check.NotNull(modelBuilder, nameof(modelBuilder));
@@ -135,8 +135,8 @@ public static bool CanSetIdentityColumnIncrement(
135135
modelBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation);
136136
if (valueGenerationStrategy != JetValueGenerationStrategy.IdentityColumn)
137137
{
138-
modelBuilder.HasIdentityColumnSeed(null, fromDataAnnotation);
139-
modelBuilder.HasIdentityColumnIncrement(null, fromDataAnnotation);
138+
modelBuilder.HasJetIdentityColumnSeed(null, fromDataAnnotation);
139+
modelBuilder.HasJetIdentityColumnIncrement(null, fromDataAnnotation);
140140
}
141141

142142
return modelBuilder;

src/EFCore.Jet/Extensions/JetModelExtensions.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ public static class JetModelExtensions
1515
/// </summary>
1616
/// <param name="model"> The model. </param>
1717
/// <returns> The default identity seed. </returns>
18-
public static int GetIdentitySeed([NotNull] this IReadOnlyModel model)
19-
=> (int?) model[JetAnnotationNames.IdentitySeed] ?? 1;
18+
public static int GetJetIdentitySeed([NotNull] this IReadOnlyModel model)
19+
=> (int?)model[JetAnnotationNames.IdentitySeed] ?? 1;
2020

2121
/// <summary>
2222
/// Sets the default identity seed.
2323
/// </summary>
2424
/// <param name="model"> The model. </param>
2525
/// <param name="seed"> The value to set. </param>
26-
public static void SetIdentitySeed([NotNull] this IMutableModel model, int? seed)
26+
public static void SetJetIdentitySeed([NotNull] this IMutableModel model, int? seed)
2727
=> model.SetOrRemoveAnnotation(
2828
JetAnnotationNames.IdentitySeed,
2929
seed);
@@ -34,7 +34,7 @@ public static void SetIdentitySeed([NotNull] this IMutableModel model, int? seed
3434
/// <param name="model"> The model. </param>
3535
/// <param name="seed"> The value to set. </param>
3636
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
37-
public static void SetIdentitySeed([NotNull] this IConventionModel model, int? seed, bool fromDataAnnotation = false)
37+
public static void SetJetIdentitySeed([NotNull] this IConventionModel model, int? seed, bool fromDataAnnotation = false)
3838
=> model.SetOrRemoveAnnotation(
3939
JetAnnotationNames.IdentitySeed,
4040
seed,
@@ -45,23 +45,23 @@ public static void SetIdentitySeed([NotNull] this IConventionModel model, int? s
4545
/// </summary>
4646
/// <param name="model"> The model. </param>
4747
/// <returns> The <see cref="ConfigurationSource" /> for the default schema. </returns>
48-
public static ConfigurationSource? GetIdentitySeedConfigurationSource([NotNull] this IConventionModel model)
48+
public static ConfigurationSource? GetJetIdentitySeedConfigurationSource([NotNull] this IConventionModel model)
4949
=> model.FindAnnotation(JetAnnotationNames.IdentitySeed)?.GetConfigurationSource();
5050

5151
/// <summary>
5252
/// Returns the default identity increment.
5353
/// </summary>
5454
/// <param name="model"> The model. </param>
5555
/// <returns> The default identity increment. </returns>
56-
public static int GetIdentityIncrement([NotNull] this IReadOnlyModel model)
57-
=> (int?) model[JetAnnotationNames.IdentityIncrement] ?? 1;
56+
public static int GetJetIdentityIncrement([NotNull] this IReadOnlyModel model)
57+
=> (int?)model[JetAnnotationNames.IdentityIncrement] ?? 1;
5858

5959
/// <summary>
6060
/// Sets the default identity increment.
6161
/// </summary>
6262
/// <param name="model"> The model. </param>
6363
/// <param name="increment"> The value to set. </param>
64-
public static void SetIdentityIncrement([NotNull] this IMutableModel model, int? increment)
64+
public static void SetJetIdentityIncrement([NotNull] this IMutableModel model, int? increment)
6565
=> model.SetOrRemoveAnnotation(
6666
JetAnnotationNames.IdentityIncrement,
6767
increment);
@@ -72,7 +72,7 @@ public static void SetIdentityIncrement([NotNull] this IMutableModel model, int?
7272
/// <param name="model"> The model. </param>
7373
/// <param name="increment"> The value to set. </param>
7474
/// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param>
75-
public static void SetIdentityIncrement(
75+
public static void SetJetIdentityIncrement(
7676
[NotNull] this IConventionModel model, int? increment, bool fromDataAnnotation = false)
7777
=> model.SetOrRemoveAnnotation(
7878
JetAnnotationNames.IdentityIncrement,
@@ -84,7 +84,7 @@ public static void SetIdentityIncrement(
8484
/// </summary>
8585
/// <param name="model"> The model. </param>
8686
/// <returns> The <see cref="ConfigurationSource" /> for the default identity increment. </returns>
87-
public static ConfigurationSource? GetIdentityIncrementConfigurationSource([NotNull] this IConventionModel model)
87+
public static ConfigurationSource? GetJetIdentityIncrementConfigurationSource([NotNull] this IConventionModel model)
8888
=> model.FindAnnotation(JetAnnotationNames.IdentityIncrement)?.GetConfigurationSource();
8989

9090
/// <summary>
@@ -94,7 +94,7 @@ public static void SetIdentityIncrement(
9494
/// <param name="model"> The model. </param>
9595
/// <returns> The default <see cref="JetValueGenerationStrategy" />. </returns>
9696
public static JetValueGenerationStrategy? GetValueGenerationStrategy([NotNull] this IReadOnlyModel model)
97-
=> (JetValueGenerationStrategy?) model[JetAnnotationNames.ValueGenerationStrategy];
97+
=> (JetValueGenerationStrategy?)model[JetAnnotationNames.ValueGenerationStrategy];
9898

9999
/// <summary>
100100
/// Sets the <see cref="JetValueGenerationStrategy" /> to use for properties
@@ -121,7 +121,7 @@ public static void SetValueGenerationStrategy(
121121
/// </summary>
122122
/// <param name="model"> The model. </param>
123123
/// <returns> The <see cref="ConfigurationSource" /> for the default <see cref="JetValueGenerationStrategy" />. </returns>
124-
public static ConfigurationSource? GetValueGenerationStrategyConfigurationSource([NotNull] this IConventionModel model)
124+
public static ConfigurationSource? GetJetValueGenerationStrategyConfigurationSource([NotNull] this IConventionModel model)
125125
=> model.FindAnnotation(JetAnnotationNames.ValueGenerationStrategy)?.GetConfigurationSource();
126126
}
127127
}

0 commit comments

Comments
 (0)