From 42d940e06b0dbd2ce726bd13851851ea18b7fbf7 Mon Sep 17 00:00:00 2001 From: Alexander Zaytsev Date: Thu, 12 Apr 2018 00:41:01 +1200 Subject: [PATCH 1/2] Allow any `cache.*` property in NHibernate configuration Fixes #1650 --- .../CfgTest/ConfigurationSchemaFixture.cs | 4 +- src/NHibernate/nhibernate-configuration.xsd | 293 +++++++++--------- 2 files changed, 154 insertions(+), 143 deletions(-) diff --git a/src/NHibernate.Test/CfgTest/ConfigurationSchemaFixture.cs b/src/NHibernate.Test/CfgTest/ConfigurationSchemaFixture.cs index ac18c80da72..f47b851ab70 100644 --- a/src/NHibernate.Test/CfgTest/ConfigurationSchemaFixture.cs +++ b/src/NHibernate.Test/CfgTest/ConfigurationSchemaFixture.cs @@ -95,16 +95,18 @@ public void Properties() Value of connection.provider Value of default_schema + Some cache configuration "; XmlTextReader xtr = new XmlTextReader(xml, XmlNodeType.Document, null); HibernateConfiguration hc = new HibernateConfiguration(xtr); - Assert.AreEqual(2, hc.SessionFactory.Properties.Count); + Assert.AreEqual(3, hc.SessionFactory.Properties.Count); Assert.IsTrue(hc.SessionFactory.Properties.ContainsKey("connection.provider")); Assert.IsTrue(hc.SessionFactory.Properties.ContainsKey("default_schema")); Assert.AreEqual("Value of connection.provider", hc.SessionFactory.Properties["connection.provider"]); Assert.AreEqual("Value of default_schema", hc.SessionFactory.Properties["default_schema"]); + Assert.AreEqual("Some cache configuration", hc.SessionFactory.Properties["cache.some_category.setting_name"]); } [Test] diff --git a/src/NHibernate/nhibernate-configuration.xsd b/src/NHibernate/nhibernate-configuration.xsd index ff7d776242e..1232ccd58b3 100644 --- a/src/NHibernate/nhibernate-configuration.xsd +++ b/src/NHibernate/nhibernate-configuration.xsd @@ -70,149 +70,158 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Set the default timeout in seconds for ADO.NET queries. - - - - - - - - - - - - - - - - - - - - - - - - - - - Timeout duration in milliseconds for the system transaction completion lock. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set the default timeout in seconds for ADO.NET queries. + + + + + + + + + + + + + + + + + + + + + + + + + + + Timeout duration in milliseconds for the system transaction completion lock. - When a system transaction completes, it may have its completion events running on concurrent threads, - after scope disposal. This occurs when the transaction is distributed. - This notably concerns ISessionImplementor.AfterTransactionCompletion(bool, ITransaction). - NHibernate protects the session from being concurrently used by the code following the scope disposal - with a lock. To prevent any application freeze, this lock has a default timeout of five seconds. If the - application appears to require longer (!) running transaction completion events, this setting allows to - raise this timeout. -1 disables the timeout. - - - - - - - When a system transaction is being prepared/prepared, is using connection during this process enabled? - Default is true, for supporting FlushMode.Commit with transaction factories - supporting system transactions. But this requires enlisting additional connections, retaining disposed - sessions and their connections till transaction end, and may trigger undesired transaction promotions to - distributed. Set to false for disabling using connections from system - transaction preparation, while still benefiting from FlushMode.Auto on querying. - - - - - - - Oracle has a dual Unicode support model. - Either the whole database use an Unicode encoding, and then all string types - will be Unicode. In such case, Unicode strings should be mapped to non N prefixed - types, such as Varchar2. This is the default. - Or N prefixed types such as NVarchar2 are to be used for Unicode strings. - See https://docs.oracle.com/cd/B19306_01/server.102/b14225/ch6unicode.htm#CACHCAHF - https://docs.oracle.com/database/121/ODPNT/featOraCommand.htm#i1007557 - This setting applies only to Oracle dialects and ODP.Net managed or unmanaged driver. - - - - - - - Disable switching built-in NHibernate date-time types from DbType.DateTime to DbType.DateTime2 - for dialects supporting datetime2. - - - - - - - Set the default length used in casting when the target type is length bound and - does not specify it. 4000 by default, automatically trimmed down according to dialect type registration. - - - - - - - Set the default precision used in casting when the target type is decimal and - does not specify it. 29 by default, automatically trimmed down according to dialect type registration. - - - - - - - Set the default scale used in casting when the target type is decimal and - does not specify it. 10 by default, automatically trimmed down according to dialect type registration. - - - - - - - Set whether tracking the session id or not. When true, each session will have an unique Guid - that can be retrieved by ISessionImplementor.SessionId, otherwise ISessionImplementor.SessionId will - always be Guid.Empty. Session id is used for logging purpose that can be also retrieved in a static - context by SessionIdLoggingContext.SessionId, where the current session id is stored, when tracking - is enabled. In case the current session id won't be used, it is recommended to disable it, in order - to increase performance. - True by default. - - - - + When a system transaction completes, it may have its completion events running on concurrent threads, + after scope disposal. This occurs when the transaction is distributed. + This notably concerns ISessionImplementor.AfterTransactionCompletion(bool, ITransaction). + NHibernate protects the session from being concurrently used by the code following the scope disposal + with a lock. To prevent any application freeze, this lock has a default timeout of five seconds. If the + application appears to require longer (!) running transaction completion events, this setting allows to + raise this timeout. -1 disables the timeout. + + + + + + + When a system transaction is being prepared/prepared, is using connection during this process enabled? + Default is true, for supporting FlushMode.Commit with transaction factories + supporting system transactions. But this requires enlisting additional connections, retaining disposed + sessions and their connections till transaction end, and may trigger undesired transaction promotions to + distributed. Set to false for disabling using connections from system + transaction preparation, while still benefiting from FlushMode.Auto on querying. + + + + + + + Oracle has a dual Unicode support model. + Either the whole database use an Unicode encoding, and then all string types + will be Unicode. In such case, Unicode strings should be mapped to non N prefixed + types, such as Varchar2. This is the default. + Or N prefixed types such as NVarchar2 are to be used for Unicode strings. + See https://docs.oracle.com/cd/B19306_01/server.102/b14225/ch6unicode.htm#CACHCAHF + https://docs.oracle.com/database/121/ODPNT/featOraCommand.htm#i1007557 + This setting applies only to Oracle dialects and ODP.Net managed or unmanaged driver. + + + + + + + Disable switching built-in NHibernate date-time types from DbType.DateTime to DbType.DateTime2 + for dialects supporting datetime2. + + + + + + + Set the default length used in casting when the target type is length bound and + does not specify it. 4000 by default, automatically trimmed down according to dialect type registration. + + + + + + + Set the default precision used in casting when the target type is decimal and + does not specify it. 29 by default, automatically trimmed down according to dialect type registration. + + + + + + + Set the default scale used in casting when the target type is decimal and + does not specify it. 10 by default, automatically trimmed down according to dialect type registration. + + + + + + + Set whether tracking the session id or not. When true, each session will have an unique Guid + that can be retrieved by ISessionImplementor.SessionId, otherwise ISessionImplementor.SessionId will + always be Guid.Empty. Session id is used for logging purpose that can be also retrieved in a static + context by SessionIdLoggingContext.SessionId, where the current session id is stored, when tracking + is enabled. In case the current session id won't be used, it is recommended to disable it, in order + to increase performance. + True by default. + + + + + + + + + + + From ab93f574dc7e9e076cd283cbf14e04df7c72b7f9 Mon Sep 17 00:00:00 2001 From: Alexander Zaytsev Date: Thu, 12 Apr 2018 01:15:39 +1200 Subject: [PATCH 2/2] Fix pattern --- src/NHibernate/nhibernate-configuration.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NHibernate/nhibernate-configuration.xsd b/src/NHibernate/nhibernate-configuration.xsd index 1232ccd58b3..48eedddbdf0 100644 --- a/src/NHibernate/nhibernate-configuration.xsd +++ b/src/NHibernate/nhibernate-configuration.xsd @@ -218,7 +218,7 @@ - +