My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 42 attachment: ProcessStatementElement.cs.patch (1.9 KB)

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
--- trunk/src/MyBatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessStatementElement.cs
+++ trunk/src/MyBatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessStatementElement.cs
@@ -1,4 +1,4 @@
-#region Apache Notice
+ #region Apache Notice
/*****************************************************************************
* $Header: $
* $Revision: 591621 $
@@ -36,9 +36,10 @@
/// <param name="configurationStore">The configuration store.</param>
private void ProcessStatementElement(Tag element, IConfigurationStore configurationStore)
{
+ bool useStatementNamespaces = TryGetSettingBoolean(configurationStore, ConfigConstants.ATTRIBUTE_USE_STATEMENT_NAMESPACES, true);
MutableConfiguration config = new MutableConfiguration(
element.Name,
- element.Attributes[ConfigConstants.ATTRIBUTE_ID]);
+ useStatementNamespaces ? ApplyNamespace(element.Attributes[ConfigConstants.ATTRIBUTE_ID]) : element.Attributes[ConfigConstants.ATTRIBUTE_ID]);
config.CreateAttributes(element.Attributes);
config.CreateAttribute(ConfigConstants.ATTRIBUTE_NAMESPACE, nameSpace);

@@ -60,5 +61,18 @@
: config.Attributes[configConstant];
}
}
+ /// <summary>
+ /// Used by XmlMappingProcessor to retrieve configuration values from configurationStore.
+ /// </summary>
+ private bool TryGetSettingBoolean(IConfigurationStore configurationStore, string attributeKey, bool defaultValue)
+ {
+ var setting = configurationStore.Settings[attributeKey];
+ if (setting != null)
+ {
+ return (bool)setting.GetValue(typeof(bool), defaultValue);
+ }
+
+ return defaultValue;
+ }
}
}
Powered by Google Project Hosting