This repository was archived by the owner on Feb 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathLinqToDBForEFTools.cs
628 lines (524 loc) · 23.3 KB
/
LinqToDBForEFTools.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
using System;
using System.Collections.Concurrent;
using System.Data.Common;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.Logging;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace LinqToDB.EntityFrameworkCore
{
using Async;
using Data;
using DataProvider;
using Linq;
using Mapping;
using Metadata;
using Expressions;
using Internal;
using System.Diagnostics.CodeAnalysis;
/// <summary>
/// EF Core <see cref="DbContext"/> extensions to call LINQ To DB functionality.
/// </summary>
[PublicAPI]
public static partial class LinqToDBForEFTools
{
static readonly Lazy<bool> _initialized = new(InitializeInternal);
/// <summary>
/// Initializes integration of LINQ To DB with EF Core.
/// </summary>
public static void Initialize()
{
var _ = _initialized.Value;
}
static bool InitializeInternal()
{
var prev = LinqExtensions.ProcessSourceQueryable;
InitializeMapping();
var instantiator = MemberHelper.MethodOf(() => Internals.CreateExpressionQueryInstance<int>(null!, null!))
.GetGenericMethodDefinition();
LinqExtensions.ProcessSourceQueryable = queryable =>
{
// our Provider - nothing to do
if (queryable.Provider is IQueryProviderAsync)
return queryable;
var context = Implementation.GetCurrentContext(queryable)
?? throw new LinqToDBForEFToolsException("Can not evaluate current context from query");
var dc = CreateLinqToDBContext(context);
var newExpression = queryable.Expression;
var result = (IQueryable)instantiator.MakeGenericMethod(queryable.ElementType)
.Invoke(null, [dc, newExpression])!;
if (prev != null)
result = prev(result);
return result;
};
LinqExtensions.ExtensionsAdapter = new LinqToDBExtensionsAdapter();
return true;
}
static ILinqToDBForEFTools _implementation;
/// <summary>
/// Gets or sets EF Core to LINQ To DB integration bridge implementation.
/// </summary>
public static ILinqToDBForEFTools Implementation
{
get => _implementation;
[MemberNotNull(nameof(_implementation), nameof(_defaultMetadataReader))]
set
{
_implementation = value ?? throw new ArgumentNullException(nameof(value));
_metadataReaders.Clear();
_defaultMetadataReader = new Lazy<IMetadataReader?>(() => Implementation.CreateMetadataReader(null, null));
}
}
static readonly ConcurrentDictionary<IModel, IMetadataReader?> _metadataReaders = new();
static Lazy<IMetadataReader?> _defaultMetadataReader;
/// <summary>
/// Clears internal caches
/// </summary>
public static void ClearCaches()
{
_metadataReaders.Clear();
Implementation.ClearCaches();
Query.ClearCaches();
}
static LinqToDBForEFTools()
{
Implementation = new LinqToDBForEFToolsImplDefault();
Initialize();
}
/// <summary>
/// Creates or return existing metadata provider for provided EF Core data model. If model is null, empty metadata
/// provider will be returned.
/// </summary>
/// <param name="model">EF Core data model instance. Could be <c>null</c>.</param>
/// <param name="accessor">EF Core service provider.</param>
/// <returns>LINQ To DB metadata provider.</returns>
public static IMetadataReader? GetMetadataReader(
IModel? model,
IInfrastructure<IServiceProvider>? accessor)
{
if (model == null)
return _defaultMetadataReader.Value;
return _metadataReaders.GetOrAdd(model, m => Implementation.CreateMetadataReader(model, accessor));
}
/// <summary>
/// Returns EF Core <see cref="DbContextOptions"/> for specific <see cref="DbContext"/> instance.
/// </summary>
/// <param name="context">EF Core <see cref="DbContext"/> instance.</param>
/// <returns><see cref="DbContextOptions"/> instance.</returns>
public static IDbContextOptions? GetContextOptions(DbContext context)
{
return Implementation.GetContextOptions(context);
}
/// <summary>
/// Returns EF Core database provider information for specific <see cref="DbContext"/> instance.
/// </summary>
/// <param name="context">EF Core <see cref="DbContext"/> instance.</param>
/// <returns>EF Core provider information.</returns>
public static EFProviderInfo GetEFProviderInfo(DbContext context)
{
var info = new EFProviderInfo
{
Connection = context.Database.GetDbConnection(),
Context = context,
Options = GetContextOptions(context)
};
return info;
}
/// <summary>
/// Returns EF Core database provider information for specific <see cref="DbConnection"/> instance.
/// </summary>
/// <param name="connection">EF Core <see cref="DbConnection"/> instance.</param>
/// <returns>EF Core provider information.</returns>
public static EFProviderInfo GetEFProviderInfo(DbConnection connection)
{
var info = new EFProviderInfo
{
Connection = connection,
Context = null,
Options = null
};
return info;
}
/// <summary>
/// Returns EF Core database provider information for specific <see cref="DbContextOptions"/> instance.
/// </summary>
/// <param name="options">EF Core <see cref="DbContextOptions"/> instance.</param>
/// <returns>EF Core provider information.</returns>
public static EFProviderInfo GetEFProviderInfo(DbContextOptions options)
{
var info = new EFProviderInfo
{
Connection = null,
Context = null,
Options = options
};
return info;
}
/// <summary>
/// Returns LINQ To DB provider, based on provider data from EF Core.
/// </summary>
/// <param name="options">Linq To DB context options.</param>
/// <param name="info">EF Core provider information.</param>
/// <param name="connectionInfo">Database connection information.</param>
/// <returns>LINQ TO DB provider instance.</returns>
public static IDataProvider GetDataProvider(DataOptions options, EFProviderInfo info, EFConnectionInfo connectionInfo)
{
var provider = Implementation.GetDataProvider(options, info, connectionInfo)
?? throw new LinqToDBForEFToolsException("Can not detect provider from Entity Framework or provider not supported");
return provider;
}
/// <summary>
/// Creates mapping schema using provided EF Core data model.
/// </summary>
/// <param name="model">EF Core data model.</param>
/// <param name="accessor">EF Core service provider.</param>
/// <param name="dataOptions">Linq To DB context options.</param>
/// <returns>Mapping schema for provided EF Core model.</returns>
public static MappingSchema GetMappingSchema(
IModel model,
IInfrastructure<IServiceProvider>? accessor,
DataOptions? dataOptions)
{
var converterSelector = accessor?.GetService<IValueConverterSelector>();
return Implementation.GetMappingSchema(model, GetMetadataReader(model, accessor), converterSelector, dataOptions);
}
/// <summary>
/// Transforms EF Core expression tree to LINQ To DB expression.
/// </summary>
/// <param name="expression">EF Core expression tree.</param>
/// <param name="dc">LINQ To DB <see cref="IDataContext"/> instance.</param>
/// <param name="ctx">Optional DbContext instance.</param>
/// <param name="model">EF Core data model instance.</param>
/// <returns>Transformed expression.</returns>
public static Expression TransformExpression(Expression expression, IDataContext? dc, DbContext? ctx, IModel? model)
{
return Implementation.TransformExpression(expression, dc, ctx, model);
}
/// <summary>
/// Creates LINQ To DB <see cref="DataConnection"/> instance, attached to provided
/// EF Core <see cref="DbContext"/> instance connection and transaction.
/// </summary>
/// <param name="context">EF Core <see cref="DbContext"/> instance.</param>
/// <param name="transaction">Optional transaction instance, to which created connection should be attached.
/// If not specified, will use current <see cref="DbContext"/> transaction if it available.</param>
/// <returns>LINQ To DB <see cref="DataConnection"/> instance.</returns>
[Obsolete($"Use {nameof(CreateLinqToDBConnection)} overload.")]
public static DataConnection CreateLinqToDbConnection(this DbContext context,
IDbContextTransaction? transaction = null)
=> CreateLinqToDBConnection(context, transaction);
/// <summary>
/// Creates LINQ To DB <see cref="DataConnection"/> instance, attached to provided
/// EF Core <see cref="DbContext"/> instance connection and transaction.
/// </summary>
/// <param name="context">EF Core <see cref="DbContext"/> instance.</param>
/// <param name="transaction">Optional transaction instance, to which created connection should be attached.
/// If not specified, will use current <see cref="DbContext"/> transaction if it available.</param>
/// <returns>LINQ To DB <see cref="DataConnection"/> instance.</returns>
public static DataConnection CreateLinqToDBConnection(this DbContext context,
IDbContextTransaction? transaction = null)
{
ArgumentNullException.ThrowIfNull(context);
var info = GetEFProviderInfo(context);
var options = context.GetLinqToDBOptions() ?? new DataOptions();
options = AddMappingSchema(options, GetMappingSchema(context.Model, context, options));
DataConnection? dc = null;
transaction ??= context.Database.CurrentTransaction;
var connectionInfo = GetConnectionInfo(info);
var provider = GetDataProvider(options, info, connectionInfo);
if (transaction != null)
{
var dbTransaction = transaction.GetDbTransaction();
// TODO: we need API for testing current connection
//if (provider.IsCompatibleConnection(dbTransaction.Connection))
options = options.UseTransaction(provider, dbTransaction);
dc = new LinqToDBForEFToolsDataConnection(context, options, context.Model, TransformExpression);
}
if (dc == null)
{
var dbConnection = context.Database.GetDbConnection();
// TODO: we need API for testing current connection
options = options.UseConnection(provider, dbConnection);
if (true /*provider.IsCompatibleConnection(dbConnection)*/)
dc = new LinqToDBForEFToolsDataConnection(context, options, context.Model, TransformExpression);
else
{
//dc = new LinqToDBForEFToolsDataConnection(context, provider, connectionInfo.ConnectionString, context.Model, TransformExpression);
}
}
var logger = CreateLogger(info.Options);
if (logger != null)
EnableTracing(dc, logger);
return dc;
}
private static readonly TraceSwitch _defaultTraceSwitch =
new("DataConnection", "DataConnection trace switch", TraceLevel.Info.ToString());
static void EnableTracing(DataConnection dc, ILogger logger)
{
dc.OnTraceConnection = t => Implementation.LogConnectionTrace(t, logger);
dc.TraceSwitchConnection = _defaultTraceSwitch;
}
/// <summary>
/// Creates logger instance.
/// </summary>
/// <param name="options"><see cref="DbContext" /> options.</param>
/// <returns>Logger instance.</returns>
public static ILogger? CreateLogger(IDbContextOptions? options)
{
return Implementation.CreateLogger(options);
}
/// <summary>
/// Creates Linq To DB data context for EF Core database context.
/// </summary>
/// <param name="context">EF Core database context.</param>
/// <param name="transaction">Transaction instance.</param>
/// <returns>Linq To DB data context.</returns>
[Obsolete($"Use {nameof(CreateLinqToDBContext)} overload.")]
public static IDataContext CreateLinqToDbContext(this DbContext context,
IDbContextTransaction? transaction = null)
=> CreateLinqToDBContext(context, transaction);
/// <summary>
/// Creates Linq To DB data context for EF Core database context.
/// </summary>
/// <param name="context">EF Core database context.</param>
/// <param name="transaction">Transaction instance.</param>
/// <returns>Linq To DB data context.</returns>
public static IDataContext CreateLinqToDBContext(this DbContext context,
IDbContextTransaction? transaction = null)
{
ArgumentNullException.ThrowIfNull(context);
var info = GetEFProviderInfo(context);
var options = context.GetLinqToDBOptions() ?? new DataOptions();
options = AddMappingSchema(options, GetMappingSchema(context.Model, context, options));
DataConnection? dc = null;
transaction ??= context.Database.CurrentTransaction;
var connectionInfo = GetConnectionInfo(info);
var provider = GetDataProvider(options, info, connectionInfo);
var logger = CreateLogger(info.Options);
if (transaction != null)
{
var dbTransaction = transaction.GetDbTransaction();
// TODO: we need API for testing current connection
// if (provider.IsCompatibleConnection(dbTransaction.Connection))
options = options.UseTransaction(provider, dbTransaction);
dc = new LinqToDBForEFToolsDataConnection(context, options, context.Model, TransformExpression);
}
if (dc == null)
{
var dbConnection = context.Database.GetDbConnection();
// TODO: we need API for testing current connection
options = options.UseConnection(provider, dbConnection);
if (true /*provider.IsCompatibleConnection(dbConnection)*/)
dc = new LinqToDBForEFToolsDataConnection(context, options, context.Model, TransformExpression);
else
{
/*
// special case when we have to create data connection by itself
var dataContext = new LinqToDBForEFToolsDataContext(context, provider, connectionInfo.ConnectionString, context.Model, TransformExpression);
if (mappingSchema != null)
dataContext.MappingSchema = mappingSchema;
if (logger != null)
dataContext.OnTraceConnection = t => Implementation.LogConnectionTrace(t, logger);
return dataContext;
*/
}
}
if (logger != null)
EnableTracing(dc, logger);
return dc;
}
/// <summary>
/// Creates LINQ To DB <see cref="DataConnection"/> instance that creates new database connection using connection
/// information from EF Core <see cref="DbContext"/> instance.
/// </summary>
/// <param name="context">EF Core <see cref="DbContext"/> instance.</param>
/// <returns>LINQ To DB <see cref="DataConnection"/> instance.</returns>
[Obsolete($"Use {nameof(CreateLinqToDBConnectionDetached)} overload.")]
public static DataConnection CreateLinq2DbConnectionDetached(this DbContext context)
=> CreateLinqToDBConnectionDetached(context);
/// <summary>
/// Creates LINQ To DB <see cref="DataConnection"/> instance that creates new database connection using connection
/// information from EF Core <see cref="DbContext"/> instance.
/// </summary>
/// <param name="context">EF Core <see cref="DbContext"/> instance.</param>
/// <returns>LINQ To DB <see cref="DataConnection"/> instance.</returns>
public static DataConnection CreateLinqToDBConnectionDetached(this DbContext context)
{
ArgumentNullException.ThrowIfNull(context);
var info = GetEFProviderInfo(context);
var connectionInfo = GetConnectionInfo(info);
var options = context.GetLinqToDBOptions() ?? new DataOptions();
var dataProvider = GetDataProvider(options, info, connectionInfo);
options = AddMappingSchema(options, GetMappingSchema(context.Model, context, options))
.UseDataProvider(dataProvider)
.UseConnectionString(connectionInfo.ConnectionString!);
var dc = new LinqToDBForEFToolsDataConnection(context, options, context.Model, TransformExpression);
var logger = CreateLogger(info.Options);
if (logger != null)
EnableTracing(dc, logger);
return dc;
}
static readonly ConcurrentDictionary<Type, Func<DbConnection, string>> _connectionStringExtractors = new();
/// <summary>
/// Extracts database connection information from EF Core provider data.
/// </summary>
/// <param name="info">EF Core database provider data.</param>
/// <returns>Database connection information.</returns>
public static EFConnectionInfo GetConnectionInfo(EFProviderInfo info)
{
var connection = info.Connection;
string? connectionString = null;
if (connection != null)
{
var connectionStringFunc = _connectionStringExtractors.GetOrAdd(connection.GetType(), t =>
{
// NpgSQL workaround
var originalProp = t.GetProperty("OriginalConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
if (originalProp == null)
return c => c.ConnectionString;
var parameter = Expression.Parameter(typeof(DbConnection), "c");
var lambda = Expression.Lambda<Func<DbConnection, string>>(
Expression.MakeMemberAccess(Expression.Convert(parameter, t), originalProp), parameter);
return lambda.Compile();
});
connectionString = connectionStringFunc(connection);
}
if (connection != null && connectionString != null)
return new EFConnectionInfo { Connection = connection, ConnectionString = connectionString };
var extracted = Implementation.ExtractConnectionInfo(info.Options);
return new EFConnectionInfo
{
Connection = connection ?? extracted?.Connection,
ConnectionString = extracted?.ConnectionString
};
}
/// <summary>
/// Extracts EF Core data model instance from <see cref="DbContextOptions"/>.
/// </summary>
/// <param name="options"><see cref="DbContextOptions"/> instance.</param>
/// <returns>EF Core data model instance.</returns>
public static IModel? GetModel(DbContextOptions? options)
{
if (options == null)
return null;
return Implementation.ExtractModel(options);
}
/// <summary>
/// Creates new LINQ To DB <see cref="DataConnection"/> instance using connectivity information from
/// EF Core <see cref="DbContextOptions"/> instance.
/// </summary>
/// <param name="options">EF Core <see cref="DbContextOptions"/> instance.</param>
/// <returns>New LINQ To DB <see cref="DataConnection"/> instance.</returns>
[Obsolete($"Use {nameof(CreateLinqToDBConnection)} overload.")]
public static DataConnection CreateLinqToDbConnection(this DbContextOptions options)
=> CreateLinqToDBConnection(options);
/// <summary>
/// Creates new LINQ To DB <see cref="DataConnection"/> instance using connectivity information from
/// EF Core <see cref="DbContextOptions"/> instance.
/// </summary>
/// <param name="options">EF Core <see cref="DbContextOptions"/> instance.</param>
/// <returns>New LINQ To DB <see cref="DataConnection"/> instance.</returns>
public static DataConnection CreateLinqToDBConnection(this DbContextOptions options)
{
var info = GetEFProviderInfo(options);
DataConnection? dc = null;
var connectionInfo = GetConnectionInfo(info);
var dataOptions = options.GetLinqToDBOptions() ?? new DataOptions();
var dataProvider = GetDataProvider(dataOptions, info, connectionInfo);
var model = GetModel(options);
if (model != null)
dataOptions = AddMappingSchema(dataOptions, GetMappingSchema(model, null, dataOptions));
dataOptions = dataOptions.UseDataProvider(dataProvider);
if (connectionInfo.Connection != null)
{
dataOptions = dataOptions.UseConnection(connectionInfo.Connection);
dc = new LinqToDBForEFToolsDataConnection(null, dataOptions, model, TransformExpression);
}
else if (connectionInfo.ConnectionString != null)
{
dataOptions = dataOptions.UseConnectionString(connectionInfo.ConnectionString);
dc = new LinqToDBForEFToolsDataConnection(null, dataOptions, model, TransformExpression);
}
if (dc == null)
throw new LinqToDBForEFToolsException($"Can not extract connection information from {nameof(DbContextOptions)}");
var logger = CreateLogger(info.Options);
if (logger != null)
EnableTracing(dc, logger);
return dc;
}
/// <summary>
/// Converts EF Core's query to LINQ To DB query and attach it to provided LINQ To DB <see cref="IDataContext"/>.
/// </summary>
/// <typeparam name="T">Entity type.</typeparam>
/// <param name="query">EF Core query.</param>
/// <param name="dc">LINQ To DB <see cref="IDataContext"/> to use with provided query.</param>
/// <returns>LINQ To DB query, attached to provided <see cref="IDataContext"/>.</returns>
public static IQueryable<T> ToLinqToDB<T>(this IQueryable<T> query, IDataContext dc)
{
ArgumentNullException.ThrowIfNull(query);
ArgumentNullException.ThrowIfNull(dc);
var context = Implementation.GetCurrentContext(query)
?? throw new LinqToDBForEFToolsException("Can not evaluate current context from query");
AddInterceptorsToDataContext(context, dc);
return new LinqToDBForEFQueryProvider<T>(dc, query.Expression);
}
private static void AddInterceptorsToDataContext(DbContext context, IDataContext dc)
{
var options = context.GetLinqToDBOptions();
if (options?.DataContextOptions.Interceptors?.Any() == true)
{
foreach (var interceptor in options.DataContextOptions.Interceptors)
dc.AddInterceptor(interceptor);
}
}
/// <summary>
/// Converts EF Core's query to LINQ To DB query and attach it to current EF Core connection.
/// </summary>
/// <typeparam name="T">Entity type.</typeparam>
/// <param name="query">EF Core query.</param>
/// <returns>LINQ To DB query, attached to current EF Core connection.</returns>
public static IQueryable<T> ToLinqToDB<T>(this IQueryable<T> query)
{
if (query.Provider is IQueryProviderAsync)
{
return query;
}
var context = Implementation.GetCurrentContext(query)
?? throw new LinqToDBForEFToolsException("Can not evaluate current context from query");
#pragma warning disable CA2000 // Dispose objects before losing scope
var dc = CreateLinqToDBContext(context);
#pragma warning restore CA2000 // Dispose objects before losing scope
return new LinqToDBForEFQueryProvider<T>(dc, query.Expression);
}
/// <summary>
/// Extracts <see cref="DbContext"/> instance from <see cref="IQueryable"/> object.
/// </summary>
/// <param name="query">EF Core query.</param>
/// <returns>Current <see cref="DbContext"/> instance.</returns>
public static DbContext? GetCurrentContext(IQueryable query)
{
return Implementation.GetCurrentContext(query);
}
/// <summary>
/// Enables attaching entities to change tracker.
/// Entities will be attached only if AsNoTracking() is not used in query and DbContext is configured to track entities.
/// </summary>
public static bool EnableChangeTracker
{
get => Implementation.EnableChangeTracker;
set => Implementation.EnableChangeTracker = value;
}
private static DataOptions AddMappingSchema(DataOptions dataOptions, MappingSchema mappingSchema)
{
if (dataOptions.ConnectionOptions.MappingSchema != null)
return dataOptions.UseMappingSchema(MappingSchema.CombineSchemas(dataOptions.ConnectionOptions.MappingSchema, mappingSchema));
return dataOptions.UseMappingSchema(mappingSchema);
}
}
}