9
9
10
10
namespace FluentCommand ;
11
11
12
+ /// <summary>
13
+ /// A configuration builder class
14
+ /// </summary>
12
15
public class DataConfigurationBuilder
13
16
{
14
17
private readonly IServiceCollection _services ;
@@ -19,25 +22,52 @@ public class DataConfigurationBuilder
19
22
private Type _queryGeneratorType ;
20
23
private Type _queryLoggerType ;
21
24
25
+ /// <summary>
26
+ /// Initializes a new instance of the <see cref="DataConfigurationBuilder"/> class.
27
+ /// </summary>
28
+ /// <param name="services">The services.</param>
22
29
public DataConfigurationBuilder ( IServiceCollection services )
23
30
{
24
31
_services = services ;
25
32
}
26
33
27
34
35
+ /// <summary>
36
+ /// The name of the connection to resolve the connection string from configuration.
37
+ /// </summary>
38
+ /// <param name="connectionName">Name of the connection.</param>
39
+ /// <returns>
40
+ /// The same configuration builder so that multiple calls can be chained.
41
+ /// </returns>
28
42
public DataConfigurationBuilder UseConnectionName ( string connectionName )
29
43
{
30
44
_connectionName = connectionName ;
31
45
return this ;
32
46
}
33
47
48
+ /// <summary>
49
+ /// The connection string to use with fluent command.
50
+ /// </summary>
51
+ /// <param name="connectionString">The connection string.</param>
52
+ /// <returns>
53
+ /// The same configuration builder so that multiple calls can be chained.
54
+ /// </returns>
34
55
public DataConfigurationBuilder UseConnectionString ( string connectionString )
35
56
{
36
57
_connectionString = connectionString ;
37
58
return this ;
38
59
}
39
60
40
61
62
+ /// <summary>
63
+ /// Adds the provider factory to use with this configuration.
64
+ /// </summary>
65
+ /// <typeparam name="TService">The type of the service.</typeparam>
66
+ /// <param name="providerFactory">The provider factory.</param>
67
+ /// <returns>
68
+ /// The same configuration builder so that multiple calls can be chained.
69
+ /// </returns>
70
+ /// <seealso cref="DbProviderFactory"/>
41
71
public DataConfigurationBuilder AddProviderFactory < TService > ( TService providerFactory )
42
72
where TService : DbProviderFactory
43
73
{
@@ -46,6 +76,15 @@ public DataConfigurationBuilder AddProviderFactory<TService>(TService providerFa
46
76
return this ;
47
77
}
48
78
79
+ /// <summary>
80
+ /// Adds the provider factory to use with this configuration.
81
+ /// </summary>
82
+ /// <typeparam name="TService">The type of the service.</typeparam>
83
+ /// <param name="implementationFactory">The implementation factory.</param>
84
+ /// <returns>
85
+ /// The same configuration builder so that multiple calls can be chained.
86
+ /// </returns>
87
+ /// <seealso cref="DbProviderFactory"/>
49
88
public DataConfigurationBuilder AddProviderFactory < TService > ( Func < IServiceProvider , TService > implementationFactory )
50
89
where TService : DbProviderFactory
51
90
{
@@ -54,6 +93,14 @@ public DataConfigurationBuilder AddProviderFactory<TService>(Func<IServiceProvid
54
93
return this ;
55
94
}
56
95
96
+ /// <summary>
97
+ /// Adds the provider factory to use with this configuration.
98
+ /// </summary>
99
+ /// <typeparam name="TService">The type of the service.</typeparam>
100
+ /// <returns>
101
+ /// The same configuration builder so that multiple calls can be chained.
102
+ /// </returns>
103
+ /// <seealso cref="DbProviderFactory"/>
57
104
public DataConfigurationBuilder AddProviderFactory < TService > ( )
58
105
where TService : DbProviderFactory
59
106
{
@@ -63,6 +110,15 @@ public DataConfigurationBuilder AddProviderFactory<TService>()
63
110
}
64
111
65
112
113
+ /// <summary>
114
+ /// Adds the data cache service to use with this configuration.
115
+ /// </summary>
116
+ /// <typeparam name="TService">The type of the service.</typeparam>
117
+ /// <param name="dataCache">The data cache.</param>
118
+ /// <returns>
119
+ /// The same configuration builder so that multiple calls can be chained.
120
+ /// </returns>
121
+ /// <seealso cref="IDataCache"/>
66
122
public DataConfigurationBuilder AddDataCache < TService > ( TService dataCache )
67
123
where TService : class , IDataCache
68
124
{
@@ -71,6 +127,15 @@ public DataConfigurationBuilder AddDataCache<TService>(TService dataCache)
71
127
return this ;
72
128
}
73
129
130
+ /// <summary>
131
+ /// Adds the data cache service to use with this configuration.
132
+ /// </summary>
133
+ /// <typeparam name="TService">The type of the service.</typeparam>
134
+ /// <param name="implementationFactory">The implementation factory.</param>
135
+ /// <returns>
136
+ /// The same configuration builder so that multiple calls can be chained.
137
+ /// </returns>
138
+ /// <seealso cref="IDataCache"/>
74
139
public DataConfigurationBuilder AddDataCache < TService > ( Func < IServiceProvider , TService > implementationFactory )
75
140
where TService : class , IDataCache
76
141
{
@@ -79,6 +144,14 @@ public DataConfigurationBuilder AddDataCache<TService>(Func<IServiceProvider, TS
79
144
return this ;
80
145
}
81
146
147
+ /// <summary>
148
+ /// Adds the data cache service to use with this configuration.
149
+ /// </summary>
150
+ /// <typeparam name="TService">The type of the service.</typeparam>
151
+ /// <returns>
152
+ /// The same configuration builder so that multiple calls can be chained.
153
+ /// </returns>
154
+ /// <seealso cref="IDataCache"/>
82
155
public DataConfigurationBuilder AddDataCache < TService > ( )
83
156
where TService : class , IDataCache
84
157
{
@@ -88,6 +161,15 @@ public DataConfigurationBuilder AddDataCache<TService>()
88
161
}
89
162
90
163
164
+ /// <summary>
165
+ /// Adds the query generator service to use with this configuration.
166
+ /// </summary>
167
+ /// <typeparam name="TService">The type of the service.</typeparam>
168
+ /// <param name="queryGenerator">The query generator.</param>
169
+ /// <returns>
170
+ /// The same configuration builder so that multiple calls can be chained.
171
+ /// </returns>
172
+ /// <seealso cref="IQueryGenerator"/>
91
173
public DataConfigurationBuilder AddQueryGenerator < TService > ( TService queryGenerator )
92
174
where TService : class , IQueryGenerator
93
175
{
@@ -96,6 +178,14 @@ public DataConfigurationBuilder AddQueryGenerator<TService>(TService queryGenera
96
178
return this ;
97
179
}
98
180
181
+ /// <summary>
182
+ /// Adds the query generator service to use with this configuration.
183
+ /// </summary>
184
+ /// <typeparam name="TService">The type of the service.</typeparam>
185
+ /// <returns>
186
+ /// The same configuration builder so that multiple calls can be chained.
187
+ /// </returns>
188
+ /// <seealso cref="IQueryGenerator"/>
99
189
public DataConfigurationBuilder AddQueryGenerator < TService > ( )
100
190
where TService : class , IQueryGenerator
101
191
{
@@ -104,6 +194,15 @@ public DataConfigurationBuilder AddQueryGenerator<TService>()
104
194
return this ;
105
195
}
106
196
197
+ /// <summary>
198
+ /// Adds the query generator service to use with this configuration.
199
+ /// </summary>
200
+ /// <typeparam name="TService">The type of the service.</typeparam>
201
+ /// <param name="implementationFactory">The implementation factory.</param>
202
+ /// <returns>
203
+ /// The same configuration builder so that multiple calls can be chained.
204
+ /// </returns>
205
+ /// <seealso cref="IQueryGenerator"/>
107
206
public DataConfigurationBuilder AddQueryGenerator < TService > ( Func < IServiceProvider , TService > implementationFactory )
108
207
where TService : class , IQueryGenerator
109
208
{
@@ -112,25 +211,52 @@ public DataConfigurationBuilder AddQueryGenerator<TService>(Func<IServiceProvide
112
211
return this ;
113
212
}
114
213
214
+ /// <summary>
215
+ /// Adds the SQL server generator to use with this configuration.
216
+ /// </summary>
217
+ /// <returns>
218
+ /// The same configuration builder so that multiple calls can be chained.
219
+ /// </returns>
115
220
public DataConfigurationBuilder AddSqlServerGenerator ( )
116
221
{
117
222
AddQueryGenerator < SqlServerGenerator > ( ) ;
118
223
return this ;
119
224
}
120
225
226
+ /// <summary>
227
+ /// Adds the sqlite generator to use with this configuration.
228
+ /// </summary>
229
+ /// <returns>
230
+ /// The same configuration builder so that multiple calls can be chained.
231
+ /// </returns>
121
232
public DataConfigurationBuilder AddSqliteGenerator ( )
122
233
{
123
234
AddQueryGenerator < SqliteGenerator > ( ) ;
124
235
return this ;
125
236
}
126
237
238
+ /// <summary>
239
+ /// Adds the PostgreSQL generator to use with this configuration.
240
+ /// </summary>
241
+ /// <returns>
242
+ /// The same configuration builder so that multiple calls can be chained.
243
+ /// </returns>
127
244
public DataConfigurationBuilder AddPostgreSqlGenerator ( )
128
245
{
129
246
AddQueryGenerator < PostgreSqlGenerator > ( ) ;
130
247
return this ;
131
248
}
132
249
133
250
251
+ /// <summary>
252
+ /// Adds the query logger service to use with this configuration.
253
+ /// </summary>
254
+ /// <typeparam name="TService">The type of the service.</typeparam>
255
+ /// <param name="queryLogger">The query logger.</param>
256
+ /// <returns>
257
+ /// The same configuration builder so that multiple calls can be chained.
258
+ /// </returns>
259
+ /// <seealso cref="IDataQueryLogger"/>
134
260
public DataConfigurationBuilder AddQueryLogger < TService > ( TService queryLogger )
135
261
where TService : class , IDataQueryLogger
136
262
{
@@ -139,6 +265,14 @@ public DataConfigurationBuilder AddQueryLogger<TService>(TService queryLogger)
139
265
return this ;
140
266
}
141
267
268
+ /// <summary>
269
+ /// Adds the query logger service to use with this configuration.
270
+ /// </summary>
271
+ /// <typeparam name="TService">The type of the service.</typeparam>
272
+ /// <returns>
273
+ /// The same configuration builder so that multiple calls can be chained.
274
+ /// </returns>
275
+ /// <seealso cref="IDataQueryLogger"/>
142
276
public DataConfigurationBuilder AddQueryLogger < TService > ( )
143
277
where TService : class , IDataQueryLogger
144
278
{
@@ -147,6 +281,15 @@ public DataConfigurationBuilder AddQueryLogger<TService>()
147
281
return this ;
148
282
}
149
283
284
+ /// <summary>
285
+ /// Adds the query logger service to use with this configuration.
286
+ /// </summary>
287
+ /// <typeparam name="TService">The type of the service.</typeparam>
288
+ /// <param name="implementationFactory">The implementation factory.</param>
289
+ /// <returns>
290
+ /// The same configuration builder so that multiple calls can be chained.
291
+ /// </returns>
292
+ /// <seealso cref="IDataQueryLogger"/>
150
293
public DataConfigurationBuilder AddQueryLogger < TService > ( Func < IServiceProvider , TService > implementationFactory )
151
294
where TService : class , IDataQueryLogger
152
295
{
@@ -156,6 +299,13 @@ public DataConfigurationBuilder AddQueryLogger<TService>(Func<IServiceProvider,
156
299
}
157
300
158
301
302
+ /// <summary>
303
+ /// Adds services via the configuration setup action.
304
+ /// </summary>
305
+ /// <param name="setupAction">The configuration setup action.</param>
306
+ /// <returns>
307
+ /// The same configuration builder so that multiple calls can be chained.
308
+ /// </returns>
159
309
public DataConfigurationBuilder AddService ( Action < IServiceCollection > setupAction )
160
310
{
161
311
setupAction ( _services ) ;
0 commit comments