File tree Expand file tree Collapse file tree 4 files changed +83
-0
lines changed
Src/NHibernate.Envers.Tests/Integration/LazyProperty Expand file tree Collapse file tree 4 files changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ using NHibernate . Envers . Configuration . Attributes ;
2
+
3
+ namespace NHibernate . Envers . Tests . Integration . LazyProperty
4
+ {
5
+ [ Audited ]
6
+ public class Car
7
+ {
8
+ public virtual long Id { get ; set ; }
9
+ public virtual int Number { get ; set ; }
10
+ public virtual Person Owner { get ; set ; }
11
+ }
12
+ }
Original file line number Diff line number Diff line change
1
+ using NUnit . Framework ;
2
+ using System . Linq ;
3
+
4
+ namespace NHibernate . Envers . Tests . Integration . LazyProperty
5
+ {
6
+ public class LazyPropertyTest : TestBase
7
+ {
8
+ private long id_pers1 ;
9
+
10
+ public LazyPropertyTest ( AuditStrategyForTest strategyType ) : base ( strategyType )
11
+ {
12
+ }
13
+
14
+ protected override void Initialize ( )
15
+ {
16
+ var pers1 = new Person { Name = "Hernan" } ;
17
+
18
+ using ( var tx = Session . BeginTransaction ( ) )
19
+ {
20
+ id_pers1 = ( long ) Session . Save ( pers1 ) ;
21
+ tx . Commit ( ) ;
22
+ }
23
+ }
24
+
25
+ [ Test ]
26
+ public void SavePersonProxyForFieldInterceptor ( )
27
+ {
28
+ using ( var tx = Session . BeginTransaction ( ) )
29
+ {
30
+ var pers = Session . Query < Person > ( ) . Single ( x => x . Id == id_pers1 ) ;
31
+ var car = new Car
32
+ {
33
+ Owner = pers
34
+ } ;
35
+ id_pers1 = ( long ) Session . Save ( car ) ;
36
+ tx . Commit ( ) ;
37
+ }
38
+ }
39
+ }
40
+ }
Original file line number Diff line number Diff line change
1
+ <hibernate-mapping xmlns =" urn:nhibernate-mapping-2.2"
2
+ assembly =" NHibernate.Envers.Tests"
3
+ namespace =" NHibernate.Envers.Tests.Integration.LazyProperty" >
4
+ <class name =" Person" table =" DRIVERS" >
5
+ <id name =" Id" column =" ID_PERSON" type =" long" >
6
+ <generator class =" native" />
7
+ </id >
8
+ <property name =" Name" type =" string" length =" 255"
9
+ column =" NAME" not-null =" true" lazy =" true" />
10
+ </class >
11
+
12
+
13
+ <class name =" Car" >
14
+ <id name =" Id" column =" ID_CAR" type =" long" >
15
+ <generator class =" native" />
16
+ </id >
17
+ <property name =" Number" type =" int" not-null =" true" column =" numb" />
18
+ <many-to-one name =" Owner" class =" Person" />
19
+ </class >
20
+ </hibernate-mapping >
Original file line number Diff line number Diff line change
1
+ using NHibernate . Envers . Configuration . Attributes ;
2
+
3
+ namespace NHibernate . Envers . Tests . Integration . LazyProperty
4
+ {
5
+ [ Audited ]
6
+ public class Person
7
+ {
8
+ public virtual long Id { get ; set ; }
9
+ public virtual string Name { get ; set ; }
10
+ }
11
+ }
You can’t perform that action at this time.
0 commit comments