Skip to content

Commit 5d1d476

Browse files
Merge pull request #349 from johelvisguzman/options
Changed the repository options With methods to internal
2 parents f1aaf75 + 8136349 commit 5d1d476

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

src/DotNetToolkit.Repository.AdoNet/RepositoryOptionsBuilderExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static RepositoryOptionsBuilder UseAdoNet(this RepositoryOptionsBuilder s
2424
if (nameOrConnectionString == null)
2525
throw new ArgumentNullException(nameof(nameOrConnectionString));
2626

27-
source.Options.With(new AdoNetRepositoryContextFactory(nameOrConnectionString));
27+
source.UseInternalContextFactory(new AdoNetRepositoryContextFactory(nameOrConnectionString));
2828

2929
return source;
3030
}
@@ -47,7 +47,7 @@ public static RepositoryOptionsBuilder UseAdoNet(this RepositoryOptionsBuilder s
4747
if (connectionString == null)
4848
throw new ArgumentNullException(nameof(connectionString));
4949

50-
source.Options.With(new AdoNetRepositoryContextFactory(providerName, connectionString));
50+
source.UseInternalContextFactory(new AdoNetRepositoryContextFactory(providerName, connectionString));
5151

5252
return source;
5353
}
@@ -66,7 +66,7 @@ public static RepositoryOptionsBuilder UseAdoNet(this RepositoryOptionsBuilder s
6666
if (existingConnection == null)
6767
throw new ArgumentNullException(nameof(existingConnection));
6868

69-
source.Options.With(new AdoNetRepositoryContextFactory(existingConnection));
69+
source.UseInternalContextFactory(new AdoNetRepositoryContextFactory(existingConnection));
7070

7171
return source;
7272
}

src/DotNetToolkit.Repository.EntityFramework/RepositoryOptionsBuilderExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static RepositoryOptionsBuilder UseEntityFramework<TDbContext>(this Repos
2121
if (source == null)
2222
throw new ArgumentNullException(nameof(source));
2323

24-
source.Options.With(new EfRepositoryContextFactory<TDbContext>());
24+
source.UseInternalContextFactory(new EfRepositoryContextFactory<TDbContext>());
2525

2626
return source;
2727
}
@@ -40,7 +40,7 @@ public static RepositoryOptionsBuilder UseEntityFramework<TDbContext>(this Repos
4040
if (nameOrConnectionString == null)
4141
throw new ArgumentNullException(nameof(nameOrConnectionString));
4242

43-
source.Options.With(new EfRepositoryContextFactory<TDbContext>(nameOrConnectionString));
43+
source.UseInternalContextFactory(new EfRepositoryContextFactory<TDbContext>(nameOrConnectionString));
4444

4545
return source;
4646
}
@@ -59,7 +59,7 @@ public static RepositoryOptionsBuilder UseEntityFramework<TDbContext>(this Repos
5959
if (existingConnection == null)
6060
throw new ArgumentNullException(nameof(existingConnection));
6161

62-
source.Options.With(new EfRepositoryContextFactory<TDbContext>(existingConnection));
62+
source.UseInternalContextFactory(new EfRepositoryContextFactory<TDbContext>(existingConnection));
6363

6464
return source;
6565
}

src/DotNetToolkit.Repository.EntityFrameworkCore/RepositoryOptionsBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static RepositoryOptionsBuilder UseEntityFrameworkCore<TDbContext>(this R
2020
if (source == null)
2121
throw new ArgumentNullException(nameof(source));
2222

23-
source.Options.With(new EfCoreRepositoryContextFactory<TDbContext>());
23+
source.UseInternalContextFactory(new EfCoreRepositoryContextFactory<TDbContext>());
2424

2525
return source;
2626
}
@@ -60,7 +60,7 @@ public static RepositoryOptionsBuilder UseEntityFrameworkCore<TDbContext>(this R
6060
if (options == null)
6161
throw new ArgumentNullException(nameof(options));
6262

63-
source.Options.With(new EfCoreRepositoryContextFactory<TDbContext>(options));
63+
source.UseInternalContextFactory(new EfCoreRepositoryContextFactory<TDbContext>(options));
6464

6565
return source;
6666
}

src/DotNetToolkit.Repository/Configuration/Options/RepositoryOptions.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,22 @@ public RepositoryOptions(IRepositoryOptions options)
9090
/// Clones the current configured options to a new instance.
9191
/// </summary>
9292
/// <returns>The new clone instance.</returns>
93-
public virtual RepositoryOptions Clone()
93+
public RepositoryOptions Clone()
9494
{
9595
return new RepositoryOptions(this);
9696
}
9797

98+
#endregion
99+
100+
#region Internal Methods
101+
98102
/// <summary>
99103
/// Returns the option instance with a configured interceptor.
100104
/// </summary>
101105
/// <param name="underlyingType">The type of interceptor.</param>
102106
/// <param name="interceptorFactory">The interceptor factory.</param>
103107
/// <returns>The same option instance.</returns>
104-
public virtual RepositoryOptions With(Type underlyingType, Func<IRepositoryInterceptor> interceptorFactory)
108+
internal RepositoryOptions With(Type underlyingType, Func<IRepositoryInterceptor> interceptorFactory)
105109
{
106110
if (underlyingType == null)
107111
throw new ArgumentNullException(nameof(underlyingType));
@@ -124,7 +128,7 @@ public virtual RepositoryOptions With(Type underlyingType, Func<IRepositoryInter
124128
/// </summary>
125129
/// <param name="contextFactory">The context factory.</param>
126130
/// <returns>The same option instance.</returns>
127-
public virtual RepositoryOptions With(IRepositoryContextFactory contextFactory)
131+
internal RepositoryOptions With(IRepositoryContextFactory contextFactory)
128132
{
129133
if (contextFactory == null)
130134
throw new ArgumentNullException(nameof(contextFactory));
@@ -139,7 +143,7 @@ public virtual RepositoryOptions With(IRepositoryContextFactory contextFactory)
139143
/// </summary>
140144
/// <param name="loggerProvider">The logger factory.</param>
141145
/// <returns>The same option instance.</returns>
142-
public virtual RepositoryOptions With(ILoggerProvider loggerProvider)
146+
internal RepositoryOptions With(ILoggerProvider loggerProvider)
143147
{
144148
if (loggerProvider == null)
145149
throw new ArgumentNullException(nameof(loggerProvider));
@@ -154,7 +158,7 @@ public virtual RepositoryOptions With(ILoggerProvider loggerProvider)
154158
/// </summary>
155159
/// <param name="cacheProvider">The caching provider.</param>
156160
/// <returns>The same option instance.</returns>
157-
public virtual RepositoryOptions With(ICacheProvider cacheProvider)
161+
internal RepositoryOptions With(ICacheProvider cacheProvider)
158162
{
159163
if (cacheProvider == null)
160164
throw new ArgumentNullException(nameof(cacheProvider));

0 commit comments

Comments
 (0)