Skip to content

Commit 18dcc92

Browse files
Merge branch 'master' into ColumnAndFormula
2 parents 5b0e2e7 + f3be548 commit 18dcc92

File tree

988 files changed

+12980
-3093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

988 files changed

+12980
-3093
lines changed

doc/reference/modules/component_mapping.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,6 @@
138138
model and persistence semantics are still slightly different.
139139
</para>
140140

141-
<para>
142-
A composite element mapping does not support null-able properties if you are using
143-
a <literal>&lt;set&gt;</literal>. There is no separate primary key column in the
144-
composite element table. NHibernate uses each column's value to identify a record
145-
when deleting objects, which is not possible with null values. You have to either
146-
use only not-null properties in a composite-element or choose a
147-
<literal>&lt;list&gt;</literal>, <literal>&lt;map&gt;</literal>,
148-
<literal>&lt;bag&gt;</literal> or <literal>&lt;idbag&gt;</literal>.
149-
</para>
150-
151141
<para>
152142
A special case of a composite element is a composite element with a nested
153143
<literal>&lt;many-to-one&gt;</literal> element. This mapping allows you to map extra

doc/reference/modules/configuration.xml

Lines changed: 89 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,6 @@ var session = sessions.OpenSession(conn);
441441
at runtime. All are optional and have reasonable default values.
442442
</para>
443443

444-
<para>
445-
Some properties are system-level properties. They can only be set manually by setting static properties of
446-
<literal>NHibernate.Cfg.Environment</literal> class or be defined in the
447-
<literal>&lt;hibernate-configuration&gt;</literal> section of the application
448-
configuration file. These properties cannot be set using <literal>Configuration.SetProperties</literal> or
449-
the <literal>hibernate.cfg.xml</literal> configuration file.
450-
</para>
451-
452444
<table frame="topbot" id="configuration-optional-properties" revision="3">
453445
<title>NHibernate Configuration Properties</title>
454446
<tgroup cols="2">
@@ -514,53 +506,6 @@ var session = sessions.OpenSession(conn);
514506
</para>
515507
</entry>
516508
</row>
517-
<row>
518-
<entry>
519-
<literal>use_reflection_optimizer</literal>
520-
</entry>
521-
<entry>
522-
Enables use of a runtime-generated class to set or get properties of an entity
523-
or component instead of using runtime reflection. This is a system-level property.
524-
The use of the reflection optimizer inflicts a certain startup cost on the
525-
application but should lead to better performance in the long run.
526-
Defaults to <literal>true</literal>.
527-
<para>
528-
You can not set this property in <literal>hibernate.cfg.xml</literal>, but only
529-
in <literal>&lt;hibernate-configuration&gt;</literal> section of the application
530-
configuration file or by code by setting
531-
<literal>NHibernate.Cfg.Environment.UseReflectionOptimizer</literal>
532-
before creating any <literal>NHibernate.Cfg.Configuration</literal> instance.
533-
</para>
534-
<para>
535-
<emphasis role="strong">eg.</emphasis>
536-
<literal>true</literal> | <literal>false</literal>
537-
</para>
538-
</entry>
539-
</row>
540-
<row>
541-
<entry>
542-
<literal>bytecode.provider</literal>
543-
</entry>
544-
<entry>
545-
Specifies the bytecode provider to use to optimize the use of reflection in NHibernate.
546-
This is a system-level property.
547-
Use <literal>null</literal> to disable the optimization completely, <literal>lcg</literal>
548-
to use built-in lightweight code generation, or the class name of a custom
549-
<literal>IBytecodeProvider</literal> implementation. Defaults to <literal>lcg</literal>.
550-
<para>
551-
You can not set this property in <literal>hibernate.cfg.xml</literal>, but only
552-
in <literal>&lt;hibernate-configuration&gt;</literal> section of the application
553-
configuration file or by code by setting
554-
<literal>NHibernate.Cfg.Environment.BytecodeProvider</literal>
555-
before creating any <literal>NHibernate.Cfg.Configuration</literal> instance.
556-
</para>
557-
<para>
558-
<emphasis role="strong">eg.</emphasis>
559-
<literal>null</literal> | <literal>lcg</literal> |
560-
<literal>classname.of.BytecodeProvider, assembly</literal>
561-
</para>
562-
</entry>
563-
</row>
564509
<row>
565510
<entry>
566511
<literal>cache.use_second_level_cache</literal>
@@ -1467,6 +1412,95 @@ in the parameter binding.</programlisting>
14671412

14681413
</sect2>
14691414

1415+
<sect2 id="configuration-optional-systemlevel">
1416+
<title>System level optional properties</title>
1417+
1418+
<para>
1419+
Some properties are system-level properties. They can only be set manually by setting static
1420+
properties of <literal>NHibernate.Cfg.Environment</literal> class or be defined in the
1421+
<literal>&lt;hibernate-configuration&gt;</literal> section of the application configuration
1422+
file, as direct sub-elements. These properties can neither be set using
1423+
<literal>Configuration.SetProperties</literal> or the <literal>hibernate.cfg.xml</literal>
1424+
configuration file, nor be set as <literal>&lt;session-factory&gt;</literal> properties.
1425+
</para>
1426+
1427+
<table frame="topbot" id="configuration-systemlevel-properties">
1428+
<title>NHibernate system level properties</title>
1429+
<tgroup cols="2">
1430+
<colspec colname="c1" colwidth="1*"/>
1431+
<colspec colname="c2" colwidth="1*"/>
1432+
<thead>
1433+
<row>
1434+
<entry>Property name</entry>
1435+
<entry>Purpose</entry>
1436+
</row>
1437+
</thead>
1438+
<tbody>
1439+
<row>
1440+
<entry>
1441+
<literal>bytecode-provider</literal>
1442+
</entry>
1443+
<entry>
1444+
<para>
1445+
Specifies the bytecode provider to use to optimize the use of reflection in NHibernate.
1446+
Use <literal>null</literal> to disable the optimization completely, <literal>lcg</literal>
1447+
to use built-in lightweight code generation, or the assembly qualified class name of a custom
1448+
<literal>IBytecodeProvider</literal> implementation. Defaults to <literal>lcg</literal>.
1449+
</para>
1450+
<programlisting><![CDATA[<bytecode-provider
1451+
type="lcg|null|className" />]]></programlisting>
1452+
<para>
1453+
You can also set this property by code by setting
1454+
<literal>NHibernate.Cfg.Environment.BytecodeProvider</literal>
1455+
before creating any <literal>NHibernate.Cfg.Configuration</literal> instance.
1456+
</para>
1457+
</entry>
1458+
</row>
1459+
<row>
1460+
<entry>
1461+
<literal>objects-factory</literal>
1462+
</entry>
1463+
<entry>
1464+
<para>
1465+
Specifies a custom objects factory to use for instantiating NHibernate dependencies.
1466+
Use the assembly qualified class name of a custom <literal>IObjectsFactory</literal>
1467+
implementation.
1468+
</para>
1469+
<programlisting><![CDATA[<bytecode-provider
1470+
type="className" />]]></programlisting>
1471+
<para>
1472+
You can also set this property by code by setting
1473+
<literal>NHibernate.Cfg.Environment.ObjectsFactory</literal>
1474+
before creating any <literal>NHibernate.Cfg.Configuration</literal> instance.
1475+
</para>
1476+
</entry>
1477+
</row>
1478+
<row>
1479+
<entry>
1480+
<literal>reflection-optimizer</literal>
1481+
</entry>
1482+
<entry>
1483+
<para>
1484+
Enables use of a runtime-generated class to set or get properties of an entity
1485+
or component instead of using runtime reflection. The use of the reflection
1486+
optimizer inflicts a certain startup cost on the application but should lead to
1487+
better performance in the long run. Defaults to <literal>true</literal>.
1488+
</para>
1489+
<programlisting><![CDATA[<reflection-optimizer
1490+
use="true|false"/>]]></programlisting>
1491+
<para>
1492+
You can also set this property by code by setting
1493+
<literal>NHibernate.Cfg.Environment.UseReflectionOptimizer</literal>
1494+
before creating any <literal>NHibernate.Cfg.Configuration</literal> instance.
1495+
</para>
1496+
</entry>
1497+
</row>
1498+
</tbody>
1499+
</tgroup>
1500+
</table>
1501+
1502+
</sect2>
1503+
14701504
</sect1>
14711505

14721506
<sect1 id="configuration-logging">

doc/reference/modules/persistent_classes.xml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,12 @@ namespace Eg
254254
<para>
255255
Persistent entities don't necessarily have to be represented as POCO classes
256256
at runtime. NHibernate also supports dynamic models
257-
(using <literal>Dictionaries</literal> of <literal>Dictionary</literal>s at runtime) . With this approach, you don't
257+
(using <literal>Dictionaries</literal>). With this approach, you don't
258258
write persistent classes, only mapping files.
259259
</para>
260260

261261
<para>
262-
The following examples demonstrates the representation using <literal>Map</literal>s (Dictionary).
262+
The following examples demonstrates the representation using <literal>Dictionaries</literal>.
263263
First, in the mapping file, an <literal>entity-name</literal> has to be declared
264264
instead of a class name:
265265
</para>
@@ -305,7 +305,7 @@ namespace Eg
305305
</para>
306306

307307
<para>
308-
At runtime we can work with <literal>Dictionaries</literal> of <literal>Dictionaries</literal>:
308+
At runtime we can work with <literal>Dictionaries</literal>:
309309
</para>
310310

311311
<programlisting><![CDATA[using(ISession s = OpenSession())
@@ -336,6 +336,20 @@ using(ITransaction tx = s.BeginTransaction())
336336
to the NHibernate mapping, the database schema can easily be normalized and sound,
337337
allowing to add a proper domain model implementation on top later on.
338338
</para>
339+
340+
<para>
341+
A loaded dynamic entity can be manipulated as an <literal>IDictionary</literal> or
342+
<literal>IDictionary&lt;string, object&gt;</literal>.
343+
</para>
344+
345+
<programlisting><![CDATA[using(ISession s = OpenSession())
346+
using(ITransaction tx = s.BeginTransaction())
347+
{
348+
var customers = s
349+
.CreateQuery("from Customer")
350+
.List<IDictionary<string, object>>();
351+
...
352+
}]]></programlisting>
339353
</sect1>
340354

341355
<sect1 id="persistent-classes-tuplizers" revision="1">
@@ -357,9 +371,9 @@ using(ITransaction tx = s.BeginTransaction())
357371
</para>
358372

359373
<para>
360-
Users may also plug in their own tuplizers. Perhaps you require that a <literal>System.Collections.IDictionary</literal>
361-
implementation other than <literal>System.Collections.Hashtable</literal> be used while in the
362-
dynamic-map entity-mode; or perhaps you need to define a different proxy generation strategy
374+
Users may also plug in their own tuplizers. Perhaps you require that a <literal>IDictionary</literal>
375+
implementation other than <literal>System.Collections.Generic.Dictionary&lt;string, object&gt;</literal>
376+
is used while in the dynamic-map entity-mode; or perhaps you need to define a different proxy generation strategy
363377
than the one used by default. Both would be achieved by defining a custom tuplizer
364378
implementation. Tuplizers definitions are attached to the entity or component mapping they
365379
are meant to manage. Going back to the example of our customer entity:

src/AsyncGenerator.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
- conversion: ToAsync
108108
rule: EventListener
109109
- conversion: ToAsync
110-
rule: ICache
110+
rule: Cache
111111
typeConversion:
112112
- conversion: Ignore
113113
name: EnumerableImpl
@@ -134,7 +134,7 @@
134134
- parameter: Required
135135
requiresCancellationToken:
136136
- rule: EventListener
137-
- rule: ICache
137+
- rule: Cache
138138
scanMethodBody: true
139139
scanForMissingAsyncMembers:
140140
- all: true
@@ -267,7 +267,9 @@ methodRules:
267267
name: Lock
268268
- containingType: NHibernate.Cache.ICache
269269
name: Unlock
270-
name: ICache
270+
- containingType: NHibernate.Cache.IBatchableReadOnlyCache
271+
- containingType: NHibernate.Cache.IBatchableCache
272+
name: Cache
271273
- filters:
272274
- containingNamespace: NHibernate
273275
- containingType: NHibernate.Tool.hbm2ddl.SchemaUpdate

src/NHibernate.DomainModel/NHSpecific/NullableInt32Type.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,9 @@ public override void Set(DbCommand cmd, object value, int index, ISessionImpleme
4646
}
4747
}
4848

49-
public override object FromStringValue(string xml)
50-
{
51-
return NullableInt32.Parse(xml);
52-
}
53-
5449
public override bool[] ToColumnNullness(object value, Engine.IMapping mapping)
5550
{
5651
return value == null || NullableInt32.Default.Equals(value) ? new bool[] { false } : new bool[] { true };
5752
}
5853
}
59-
}
54+
}

src/NHibernate.DomainModel/NHSpecific/NullableTypesType.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public override object Get(DbDataReader rs, string name, ISessionImplementor ses
3535
return Get(rs, rs.GetOrdinal(name), session);
3636
}
3737

38-
public override string ToString(object value)
39-
{
40-
return value.ToString();
41-
}
42-
4338
public override string Name
4439
{
4540
get { return ReturnedClass.Name; }
@@ -52,4 +47,4 @@ public override bool IsEqual(object x, object y)
5247

5348
public abstract object NullValue { get; }
5449
}
55-
}
50+
}

src/NHibernate.Test.VisualBasic/Issues/IssueTestCase.vb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,4 @@
22

33
Public Class IssueTestCase
44
Inherits BugTestCase
5-
6-
Protected Overrides ReadOnly Property MappingsAssembly As String
7-
Get
8-
Return "NHibernate.Test.VisualBasic"
9-
End Get
10-
End Property
11-
12-
Protected Overrides ReadOnly Property Mappings As IList
13-
Get
14-
Return New String() {"Issues." + BugNumber + ".Mappings.hbm.xml"}
15-
End Get
16-
End Property
17-
185
End Class

src/NHibernate.Test/Ado/BatcherFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected override string MappingsAssembly
1313
get { return "NHibernate.Test"; }
1414
}
1515

16-
protected override IList Mappings
16+
protected override string[] Mappings
1717
{
1818
get { return new[] { "Ado.VerySimple.hbm.xml", "Ado.AlmostSimple.hbm.xml" }; }
1919
}

src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class GenericBatchingBatcherFixture : TestCase
1515
{
1616
protected override string MappingsAssembly => "NHibernate.Test";
1717

18-
protected override IList Mappings => new[] {"Ado.VerySimple.hbm.xml"};
18+
protected override string[] Mappings => new[] {"Ado.VerySimple.hbm.xml"};
1919

2020
protected override void Configure(Configuration configuration)
2121
{

src/NHibernate.Test/Any/AnyTypeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ protected override string MappingsAssembly
1111
get { return "NHibernate.Test"; }
1212
}
1313

14-
protected override IList Mappings
14+
protected override string[] Mappings
1515
{
1616
get { return new string[] {"Any.Person.hbm.xml"}; }
1717
}

src/NHibernate.Test/Async/Ado/BatcherFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected override string MappingsAssembly
2525
get { return "NHibernate.Test"; }
2626
}
2727

28-
protected override IList Mappings
28+
protected override string[] Mappings
2929
{
3030
get { return new[] { "Ado.VerySimple.hbm.xml", "Ado.AlmostSimple.hbm.xml" }; }
3131
}

src/NHibernate.Test/Async/Ado/GenericBatchingBatcherFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class GenericBatchingBatcherFixtureAsync : TestCase
2828
{
2929
protected override string MappingsAssembly => "NHibernate.Test";
3030

31-
protected override IList Mappings => new[] {"Ado.VerySimple.hbm.xml"};
31+
protected override string[] Mappings => new[] {"Ado.VerySimple.hbm.xml"};
3232

3333
protected override void Configure(Configuration configuration)
3434
{

src/NHibernate.Test/Async/Any/AnyTypeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected override string MappingsAssembly
2222
get { return "NHibernate.Test"; }
2323
}
2424

25-
protected override IList Mappings
25+
protected override string[] Mappings
2626
{
2727
get { return new string[] {"Any.Person.hbm.xml"}; }
2828
}

src/NHibernate.Test/Async/BulkManipulation/NativeSQLBulkOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected override string MappingsAssembly
2323
get { return "NHibernate.Test"; }
2424
}
2525

26-
protected override IList Mappings
26+
protected override string[] Mappings
2727
{
2828
get { return new string[] { "BulkManipulation.Vehicle.hbm.xml" }; }
2929
}

src/NHibernate.Test/Async/BulkManipulation/NativeSQLBulkOperationsWithCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class NativeSQLBulkOperationsWithCacheAsync : TestCase
2727
{
2828
protected override string MappingsAssembly => "NHibernate.Test";
2929

30-
protected override IList Mappings => new[] { "BulkManipulation.Vehicle.hbm.xml" };
30+
protected override string[] Mappings => new[] { "BulkManipulation.Vehicle.hbm.xml" };
3131

3232
protected override void Configure(Configuration configuration)
3333
{

0 commit comments

Comments
 (0)