forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMappings.cs
748 lines (670 loc) · 22.9 KB
/
Mappings.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
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
using System;
using System.Collections.Generic;
using System.Text;
using NHibernate.Engine;
using NHibernate.Mapping;
namespace NHibernate.Cfg
{
/// <summary>
/// A collection of mappings from classes and collections to relational database tables.
/// </summary>
/// <remarks>Represents a single <c><hibernate-mapping></c> element.</remarks>
[Serializable]
public class Mappings
{
#region Utility classes
[Serializable]
public class ColumnNames
{
public readonly IDictionary<string, string> logicalToPhysical = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
public readonly IDictionary<string, string> physicalToLogical = new Dictionary<string, string>();
}
[Serializable]
public class TableDescription
{
public readonly string logicalName;
public readonly Table denormalizedSupertable;
public TableDescription(string logicalName, Table denormalizedSupertable)
{
this.logicalName = logicalName;
this.denormalizedSupertable = denormalizedSupertable;
}
}
[Serializable]
public sealed class PropertyReference
{
public string referencedClass;
public string propertyName;
public bool unique;
}
#endregion
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(Mappings));
private readonly IDictionary<string, PersistentClass> classes;
private readonly IDictionary<string, Mapping.Collection> collections;
private readonly IDictionary<string, Table> tables;
private readonly IDictionary<string, NamedQueryDefinition> queries;
private readonly IDictionary<string, NamedSQLQueryDefinition> sqlqueries;
private readonly IDictionary<string, ResultSetMappingDefinition> resultSetMappings;
private readonly IList<SecondPassCommand> secondPasses;
private readonly IDictionary<string, string> imports;
private string schemaName;
private string catalogName;
private string defaultCascade;
private string defaultNamespace;
private string defaultAssembly;
private string defaultAccess;
private bool autoImport;
private bool defaultLazy;
private readonly IList<PropertyReference> propertyReferences;
private readonly IDictionary<string, FilterDefinition> filterDefinitions;
private readonly IList<IAuxiliaryDatabaseObject> auxiliaryDatabaseObjects;
private readonly Queue<FilterSecondPassArgs> filtersSecondPasses;
private readonly INamingStrategy namingStrategy;
protected internal IDictionary<string, TypeDef> typeDefs;
protected internal ISet<ExtendsQueueEntry> extendsQueue;
/// <summary>
/// Binding table between the logical column name and the name out of the naming strategy
/// for each table.
/// According that when the column name is not set, the property name is considered as such
/// This means that while theoretically possible through the naming strategy contract, it is
/// forbidden to have 2 real columns having the same logical name
/// </summary>
protected internal IDictionary<Table, ColumnNames> columnNameBindingPerTable;
/// <summary>
/// Binding between logical table name and physical one (ie after the naming strategy has been applied)
/// </summary>
protected internal IDictionary<string, TableDescription> tableNameBinding;
//6.0 TODO: Remove
internal Lazy<Dialect.Dialect> LazyDialect;
//Since v5.2
[Obsolete("Please use constructor without a dialect parameter.")]
protected internal Mappings(
IDictionary<string, PersistentClass> classes,
IDictionary<string, Mapping.Collection> collections,
IDictionary<string, Table> tables,
IDictionary<string, NamedQueryDefinition> queries,
IDictionary<string, NamedSQLQueryDefinition> sqlqueries,
IDictionary<string, ResultSetMappingDefinition> resultSetMappings,
IDictionary<string, string> imports,
IList<SecondPassCommand> secondPasses,
Queue<FilterSecondPassArgs> filtersSecondPasses,
IList<PropertyReference> propertyReferences,
INamingStrategy namingStrategy,
IDictionary<string, TypeDef> typeDefs,
IDictionary<string, FilterDefinition> filterDefinitions,
ISet<ExtendsQueueEntry> extendsQueue,
IList<IAuxiliaryDatabaseObject> auxiliaryDatabaseObjects,
IDictionary<string, TableDescription> tableNameBinding,
IDictionary<Table, ColumnNames> columnNameBindingPerTable,
string defaultAssembly,
string defaultNamespace,
string defaultCatalog,
string defaultSchema,
string preferPooledValuesLo,
Dialect.Dialect dialect) :
this(
classes,
collections,
tables,
queries,
sqlqueries,
resultSetMappings,
imports,
secondPasses,
filtersSecondPasses,
propertyReferences,
namingStrategy,
typeDefs,
filterDefinitions,
extendsQueue,
auxiliaryDatabaseObjects,
tableNameBinding,
columnNameBindingPerTable,
defaultAssembly,
defaultNamespace,
defaultCatalog,
defaultSchema,
preferPooledValuesLo)
{
LazyDialect = new Lazy<Dialect.Dialect>(() => dialect);
}
protected internal Mappings(
IDictionary<string, PersistentClass> classes,
IDictionary<string, Mapping.Collection> collections,
IDictionary<string, Table> tables,
IDictionary<string, NamedQueryDefinition> queries,
IDictionary<string, NamedSQLQueryDefinition> sqlqueries,
IDictionary<string, ResultSetMappingDefinition> resultSetMappings,
IDictionary<string, string> imports,
IList<SecondPassCommand> secondPasses,
Queue<FilterSecondPassArgs> filtersSecondPasses,
IList<PropertyReference> propertyReferences,
INamingStrategy namingStrategy,
IDictionary<string, TypeDef> typeDefs,
IDictionary<string, FilterDefinition> filterDefinitions,
ISet<ExtendsQueueEntry> extendsQueue,
IList<IAuxiliaryDatabaseObject> auxiliaryDatabaseObjects,
IDictionary<string, TableDescription> tableNameBinding,
IDictionary<Table, ColumnNames> columnNameBindingPerTable,
string defaultAssembly,
string defaultNamespace,
string defaultCatalog,
string defaultSchema,
string preferPooledValuesLo)
{
this.classes = classes;
this.collections = collections;
this.queries = queries;
this.sqlqueries = sqlqueries;
this.resultSetMappings = resultSetMappings;
this.tables = tables;
this.imports = imports;
this.secondPasses = secondPasses;
this.propertyReferences = propertyReferences;
this.namingStrategy = namingStrategy;
this.typeDefs = typeDefs;
this.filterDefinitions = filterDefinitions;
this.extendsQueue = extendsQueue;
this.auxiliaryDatabaseObjects = auxiliaryDatabaseObjects;
this.tableNameBinding = tableNameBinding;
this.columnNameBindingPerTable = columnNameBindingPerTable;
this.defaultAssembly = defaultAssembly;
this.defaultNamespace = defaultNamespace;
DefaultCatalog = defaultCatalog;
DefaultSchema = defaultSchema;
PreferPooledValuesLo = preferPooledValuesLo;
this.filtersSecondPasses = filtersSecondPasses;
}
/// <summary>
///
/// </summary>
/// <param name="persistentClass"></param>
public void AddClass(PersistentClass persistentClass)
{
if (classes.ContainsKey(persistentClass.EntityName))
throw new DuplicateMappingException("class/entity", persistentClass.EntityName);
classes[persistentClass.EntityName] = persistentClass;
}
/// <summary>
///
/// </summary>
/// <param name="collection"></param>
public void AddCollection(Mapping.Collection collection)
{
if (collections.ContainsKey(collection.Role))
{
throw new DuplicateMappingException("collection role", collection.Role);
}
collections[collection.Role] = collection;
}
public void AddUniquePropertyReference(string referencedClass, string propertyName)
{
var upr = new PropertyReference {referencedClass = referencedClass, propertyName = propertyName, unique = true};
propertyReferences.Add(upr);
}
public void AddPropertyReference(string referencedClass, string propertyName)
{
var upr = new PropertyReference {referencedClass = referencedClass, propertyName = propertyName};
propertyReferences.Add(upr);
}
public PersistentClass GetClass(string className)
{
PersistentClass result;
classes.TryGetValue(className, out result);
return result;
}
//Since v5.2
[Obsolete("This property will be removed in a future version.")]
public Dialect.Dialect Dialect => LazyDialect.Value;
/// <summary>
///
/// </summary>
public INamingStrategy NamingStrategy
{
get { return namingStrategy; }
}
/// <summary>
/// The default namespace for persistent classes
/// </summary>
public string DefaultNamespace
{
get { return defaultNamespace; }
set { defaultNamespace = value; }
}
/// <summary>
/// The default assembly for persistent classes
/// </summary>
public string DefaultAssembly
{
get { return defaultAssembly; }
set { defaultAssembly = value; }
}
public string DefaultCatalog { get; set; }
public string DefaultSchema { get; set; }
public string PreferPooledValuesLo { get; set; }
public Mapping.Collection GetCollection(string role)
{
return collections[role];
}
/// <summary>
/// Adds an import to allow for the full class name <c>Namespace.Entity (AssemblyQualifiedName)</c>
/// to be referenced as <c>Entity</c> or some other name in HQL.
/// </summary>
/// <param name="className">The name of the type that is being renamed.</param>
/// <param name="rename">The new name to use in HQL for the type.</param>
/// <exception cref="MappingException">Thrown when the rename already identifies another type.</exception>
public void AddImport(string className, string rename)
{
if (rename == null)
{
throw new ArgumentNullException("rename");
}
// if the imports dictionary already contains the rename, then make sure
// the rename is not for a different className. If it is a different className
// then we probably have 2 classes with the same name in a different namespace. To
// prevent this error one of the classes needs to have the attribute "
string existing;
imports.TryGetValue(rename, out existing);
imports[rename] = className;
if (existing != null)
{
if (existing.Equals(className))
{
log.Info("duplicate import: {0}->{1}", className, rename);
}
else
{
throw new DuplicateMappingException(
"duplicate import: " + rename + " refers to both " + className + " and " + existing
+ " (try using auto-import=\"false\")", "import", rename);
}
}
}
public Table AddTable(string schema, string catalog, string name, string subselect, bool isAbstract, string schemaAction)
{
string key = subselect ?? BuildTableNameKey(catalog, schema, name);
Table table;
if (!tables.TryGetValue(key, out table))
{
table = new Table();
table.IsAbstract = isAbstract;
table.Name = name;
table.Schema = schema;
table.Catalog = catalog;
table.Subselect = subselect;
table.SchemaActions = GetSchemaActions(schemaAction);
table.UniqueInteger = tables.Count;
tables[key] = table;
}
else
{
if (!isAbstract)
table.IsAbstract = false;
}
return table;
}
private static SchemaAction GetSchemaActions(string schemaAction)
{
if (string.IsNullOrEmpty(schemaAction))
{
return SchemaAction.All;
}
else
{
SchemaAction sa = SchemaAction.None;
string[] acts = schemaAction.Split(new[] {',', ' '});
foreach (var s in acts)
{
switch (s.ToLowerInvariant())
{
case "":
case "all":
sa |= SchemaAction.All;
break;
case "drop":
sa |= SchemaAction.Drop;
break;
case "update":
sa |= SchemaAction.Update;
break;
case "export":
sa |= SchemaAction.Export;
break;
case "validate":
sa |= SchemaAction.Validate;
break;
case "none":
sa |= SchemaAction.None;
break;
default:
throw new MappingException(
string.Format("Invalid schema-export value; Expected(all drop update export validate none), Found ({0})", s));
}
}
return sa;
}
}
public Table AddDenormalizedTable(string schema, string catalog, string name, bool isAbstract, string subselect, Table includedTable)
{
string key = subselect ?? BuildTableNameKey(schema, catalog, name);
Table table = new DenormalizedTable(includedTable)
{
IsAbstract = isAbstract,
Name = name,
Catalog = catalog,
Schema = schema,
Subselect = subselect
};
var tableIndex = tables.Count;
if (tables.TryGetValue(key, out var existing))
{
if (existing.IsPhysicalTable)
{
throw new DuplicateMappingException("table", name);
}
tableIndex = existing.UniqueInteger;
}
table.UniqueInteger = tableIndex;
tables[key] = table;
return table;
}
public void AddTableBinding(string schema, string catalog, string logicalName, string physicalName, Table denormalizedSuperTable)
{
string key = BuildTableNameKey(schema, catalog, physicalName);
TableDescription tableDescription = new TableDescription(logicalName, denormalizedSuperTable);
TableDescription oldDescriptor;
tableNameBinding.TryGetValue(key, out oldDescriptor);
tableNameBinding[key] = tableDescription;
if (oldDescriptor != null && !oldDescriptor.logicalName.Equals(logicalName))
{
//TODO possibly relax that
throw new MappingException("Same physical table name reference several logical table names: " + physicalName
+ " => " + "'" + oldDescriptor.logicalName + "' and '" + logicalName + "'");
}
}
public Table GetTable(string schema, string catalog, string name)
{
string key = BuildTableNameKey(catalog, schema, name);
return tables[key];
}
public string SchemaName
{
get { return schemaName; }
set { schemaName = value; }
}
public string CatalogName
{
get { return catalogName; }
set { catalogName = value; }
}
/// <summary></summary>
public string DefaultCascade
{
get { return defaultCascade; }
set { defaultCascade = value; }
}
/// <summary></summary>
public string DefaultAccess
{
get { return defaultAccess; }
set { defaultAccess = value; }
}
private void CheckQueryExists(string name)
{
if (queries.ContainsKey(name) || sqlqueries.ContainsKey(name))
{
throw new DuplicateMappingException("query / sql-query", name);
}
}
public void AddQuery(string name, NamedQueryDefinition query)
{
CheckQueryExists(name);
queries[name] = query;
}
public void AddSQLQuery(string name, NamedSQLQueryDefinition query)
{
CheckQueryExists(name);
sqlqueries[name] = query;
}
public NamedQueryDefinition GetQuery(string name)
{
return queries[name];
}
public void AddSecondPass(SecondPassCommand command)
{
secondPasses.Add(command);
}
public void AddSecondPass(SecondPassCommand command, bool onTopOfTheQueue)
{
if (onTopOfTheQueue)
secondPasses.Insert(0, command);
else
secondPasses.Add(command);
}
/// <summary>
/// Gets or sets a boolean indicating if the Fully Qualified Type name should
/// automatically have an import added as the class name.
/// </summary>
/// <value><see langword="true" /> if the class name should be used as an import.</value>
/// <remarks>
/// Auto-import is used to shorten the string used to refer to types to just their
/// unqualified name. So if the type <c>MyAssembly.MyNamespace.MyClass, MyAssembly</c> has
/// <c>auto-import="false"</c> then all use of it in HQL would need to be the fully qualified
/// version <c>MyAssembly.MyNamespace.MyClass</c>. If <c>auto-import="true"</c>, the type could
/// be referred to in HQL as just <c>MyClass</c>.
/// </remarks>
public bool IsAutoImport
{
get { return autoImport; }
set { autoImport = value; }
}
public bool DefaultLazy
{
get { return defaultLazy; }
set { defaultLazy = value; }
}
public IDictionary<string, FilterDefinition> FilterDefinitions
{
get { return filterDefinitions; }
}
public void AddFilterDefinition(FilterDefinition definition)
{
FilterDefinition fd;
if (filterDefinitions.TryGetValue(definition.FilterName, out fd))
{
if(fd!=null)
{
throw new MappingException("Duplicated filter-def named: " + definition.FilterName);
}
}
filterDefinitions[definition.FilterName] = definition;
}
public FilterDefinition GetFilterDefinition(string name)
{
FilterDefinition result;
filterDefinitions.TryGetValue(name, out result);
return result;
}
public void AddAuxiliaryDatabaseObject(IAuxiliaryDatabaseObject auxiliaryDatabaseObject)
{
auxiliaryDatabaseObjects.Add(auxiliaryDatabaseObject);
}
public void AddResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping)
{
string name = sqlResultSetMapping.Name;
if (resultSetMappings.ContainsKey(name))
{
throw new DuplicateMappingException("resultSet", name);
}
resultSetMappings[name] = sqlResultSetMapping;
}
public void AddToExtendsQueue(ExtendsQueueEntry entry)
{
if (!extendsQueue.Contains(entry))
extendsQueue.Add(entry);
}
public void AddTypeDef(string typeName, string typeClass, IDictionary<string, string> paramMap)
{
var def = new TypeDef(typeClass, paramMap);
typeDefs[typeName] = def;
log.Debug("Added {0} with class {1}", typeName, typeClass);
}
public TypeDef GetTypeDef(string typeName)
{
if (string.IsNullOrEmpty(typeName))
return null;
TypeDef result;
typeDefs.TryGetValue(typeName, out result);
return result;
}
#region Column Name Binding
public void AddColumnBinding(string logicalName, Column finalColumn, Table table)
{
ColumnNames binding;
if (!columnNameBindingPerTable.TryGetValue(table, out binding))
{
binding = new ColumnNames();
columnNameBindingPerTable[table] = binding;
}
string oldFinalName;
binding.logicalToPhysical.TryGetValue(logicalName, out oldFinalName);
binding.logicalToPhysical[logicalName] = finalColumn.GetQuotedName();
if (oldFinalName != null &&
!(finalColumn.IsQuoted
? oldFinalName.Equals(finalColumn.GetQuotedName())
: oldFinalName.Equals(finalColumn.GetQuotedName(), StringComparison.InvariantCultureIgnoreCase)))
{
//TODO possibly relax that
throw new MappingException("Same logical column name referenced by different physical ones: " + table.Name + "."
+ logicalName + " => '" + oldFinalName + "' and '" + finalColumn.GetQuotedName() + "'");
}
string oldLogicalName;
binding.physicalToLogical.TryGetValue(finalColumn.GetQuotedName(), out oldLogicalName);
binding.physicalToLogical[finalColumn.GetQuotedName()] = logicalName;
if (oldLogicalName != null && !oldLogicalName.Equals(logicalName))
{
//TODO possibly relax that
throw new MappingException("Same physical column represented by different logical column names: " + table.Name + "."
+ finalColumn.GetQuotedName() + " => '" + oldLogicalName + "' and '" + logicalName + "'");
}
}
public string GetLogicalColumnName(string physicalName, Table table)
{
string logical = null;
Table currentTable = table;
TableDescription description;
do
{
ColumnNames binding;
if (columnNameBindingPerTable.TryGetValue(currentTable, out binding))
binding.physicalToLogical.TryGetValue(physicalName, out logical);
string key = BuildTableNameKey(currentTable.Schema, currentTable.Catalog, currentTable.Name);
if (tableNameBinding.TryGetValue(key, out description))
currentTable = description.denormalizedSupertable;
}
while (logical == null && currentTable != null && description != null);
if (logical == null)
{
throw new MappingException("Unable to find logical column name from physical name " + physicalName + " in table " + table.Name);
}
return logical;
}
public string GetPhysicalColumnName(string logicalName, Table table)
{
string finalName = null;
Table currentTable = table;
do
{
ColumnNames binding;
if (columnNameBindingPerTable.TryGetValue(currentTable, out binding))
finalName = binding.logicalToPhysical[logicalName];
string key = BuildTableNameKey(currentTable.Schema, currentTable.Catalog, currentTable.Name);
TableDescription description;
if (tableNameBinding.TryGetValue(key, out description))
currentTable = description.denormalizedSupertable;
}
while (finalName == null && currentTable != null);
if (finalName == null)
throw new MappingException("Unable to find column with logical name " + logicalName + " in table " + table.Name);
return finalName;
}
private static string BuildTableNameKey(string schema, string catalog, string name)
{
var keyBuilder = new StringBuilder();
if (schema != null)
keyBuilder.Append(schema);
keyBuilder.Append(".");
if (catalog != null)
keyBuilder.Append(catalog);
keyBuilder.Append(".");
keyBuilder.Append(name);
return keyBuilder.ToString();
}
#endregion
private string GetLogicalTableName(string schema, string catalog, string physicalName)
{
string key = BuildTableNameKey(schema, catalog, physicalName);
TableDescription descriptor;
if (!tableNameBinding.TryGetValue(key, out descriptor))
{
throw new MappingException("Unable to find physical table: " + physicalName);
}
return descriptor.logicalName;
}
public string GetLogicalTableName(Table table)
{
return GetLogicalTableName(table.GetQuotedSchema(), table.GetQuotedCatalog(), table.GetQuotedName());
}
public ResultSetMappingDefinition GetResultSetMapping(string name)
{
return resultSetMappings[name];
}
public IEnumerable<Mapping.Collection> IterateCollections
{
get { return collections.Values; }
}
public IEnumerable<Table> IterateTables
{
get { return tables.Values; }
}
public PersistentClass LocatePersistentClassByEntityName(string entityName)
{
PersistentClass persistentClass;
if (!classes.TryGetValue(entityName, out persistentClass))
{
string actualEntityName;
if (imports.TryGetValue(entityName, out actualEntityName))
classes.TryGetValue(actualEntityName, out persistentClass);
}
return persistentClass;
}
public void ExpectedFilterDefinition(IFilterable filterable, string filterName, string condition)
{
var fdef = GetFilterDefinition(filterName);
if (string.IsNullOrEmpty(condition))
{
if (fdef != null)
{
// where immediately available, apply the condition
condition = fdef.DefaultFilterCondition;
}
}
if (string.IsNullOrEmpty(condition) && fdef == null)
{
log.Debug("Adding filter second pass [{0}]", filterName);
filtersSecondPasses.Enqueue(new FilterSecondPassArgs(filterable, filterName));
}
else if (string.IsNullOrEmpty(condition) && fdef != null)
{
// Both sides does not have condition
throw new MappingException("no filter condition found for filter: " + filterName);
}
if (fdef == null)
{
// if not available add an expected filter definition
FilterDefinitions[filterName] = null;
}
}
}
public delegate void SecondPassCommand(IDictionary<string, PersistentClass> persistentClasses);
}