Skip to content

Commit 52fdaa0

Browse files
author
Mike Doerfler
committed
Modified classes and mappings to test the access="field" and the
various field naming strategies. SVN: trunk@879
1 parent 5f2285f commit 52fdaa0

File tree

7 files changed

+18
-21
lines changed

7 files changed

+18
-21
lines changed

src/NHibernate.DomainModel/Foo.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public override int GetHashCode()
6969
private byte[] _bytes;
7070
private System.Globalization.CultureInfo _locale;
7171
private String _formula;
72-
private string[] _custom;
72+
private string[] custom;
7373
private int _version;
7474
private FooProxy _foo;
7575
private Fee _dependent;
@@ -314,8 +314,8 @@ public String Formula
314314
/// </summary>
315315
public string[] Custom
316316
{
317-
get { return _custom; }
318-
set { _custom = value; }
317+
get { return custom; }
318+
set { custom = value; }
319319
}
320320

321321
/// <summary>
@@ -395,7 +395,7 @@ public LifecycleVeto OnSave(ISession s)
395395
_blob = ss;
396396
_status=FooStatus.ON;
397397
_binary = System.Text.Encoding.ASCII.GetBytes( _string + "yada yada yada" );
398-
_custom = new string[]
398+
custom = new string[]
399399
{
400400
"foo", "bar"
401401
};
@@ -465,7 +465,7 @@ public bool EqualsFoo(Foo obj)
465465
//&& ( ( _binary == other.Binary ) || _binary.Equals(other.Binary))
466466
&& ( _key.Equals(other.Key) )
467467
&& ( _locale.Equals(other.Locale) )
468-
&& ( ( _custom == other.Custom ) || ( _custom[0].Equals(other.Custom[0]) && _custom[1].Equals(other.Custom[1]) ) )
468+
&& ( ( custom == other.Custom ) || ( custom[0].Equals(other.Custom[0]) && custom[1].Equals(other.Custom[1]) ) )
469469
;
470470
}
471471

src/NHibernate.DomainModel/FooBar.hbm.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
<property name="NullBlob" type="Serializable"/>
7373
<property name="Status" column="`status_@###`" type="NHibernate.DomainModel.FooStatus, NHibernate.DomainModel"/>
7474
<property name="Binary" column="bin_"/>
75-
<property name="Locale" column="`localeayzabc123!@#$`" type="locale"/>
75+
<property name="Locale" column="`localeayzabc123!@#$`" access="field.camelcase-underscore" type="locale"/>
7676

7777
<property name="Formula" formula="1/2 * int_"/>
7878

79-
<property name="Custom" type="NHibernate.DomainModel.DoubleStringType, NHibernate.DomainModel">
79+
<property name="Custom" type="NHibernate.DomainModel.DoubleStringType, NHibernate.DomainModel" access="field.camelcase">
8080
<column name="first_name" length="66"/>
8181
<column name="surname" length="66"/>
8282
</property>
@@ -134,6 +134,7 @@
134134
cascade="all"
135135
class="NHibernate.DomainModel.Fee, NHibernate.DomainModel"
136136
outer-join="false"
137+
access="field.camelcase-underscore"
137138
/>
138139
</component>
139140

src/NHibernate.DomainModel/Fum.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class Fum : ILifecycle
1010
private Fum _fo;
1111
private Qux[] _quxArray;
1212
private IDictionary _friends; // <set> mapping
13-
private DateTime _lastUpdated;
13+
private DateTime m_LastUpdated;
1414

1515
public Fum()
1616
{
@@ -23,7 +23,7 @@ public Fum(FumCompositeID id)
2323
//TODO: H2.0.3 - this is diff from H2.0.3 because I am getting a null exception
2424
// when executing the Sql. H203 uses the CalendarType which we don't have so
2525
// I am using DateTime instead...
26-
_lastUpdated = DateTime.Now;
26+
m_LastUpdated = DateTime.Now;
2727

2828
FumCompositeID fid = new FumCompositeID();
2929
fid.Date= new DateTime(2004, 4, 29, 9, 50, 0, 0);
@@ -151,11 +151,11 @@ public DateTime LastUpdated
151151
{
152152
get
153153
{
154-
return _lastUpdated;
154+
return m_LastUpdated;
155155
}
156156
set
157157
{
158-
_lastUpdated = value;
158+
m_LastUpdated = value;
159159
}
160160
}
161161

src/NHibernate.DomainModel/Fum.hbm.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

2727
<version
2828
name="LastUpdated"
29-
type="DateTime"
29+
type="DateTime"
30+
access="field.pascalcase-m-underscore"
3031
/>
3132

3233
<property

src/NHibernate.DomainModel/Master.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class Master
2020
// since this is a version column a value should be set. NHibernate is unable
2121
// to set it right now because it checks to see if value==null -> since this
2222
// is a struct it is not null...
23-
private DateTime _stamp = DateTime.Now;
23+
private DateTime stamp = DateTime.Now;
2424
// private BigDecimal bigDecimal = new BigDecimal("1234.123"); TODO: how to do in .net
2525
private int _x;
2626

@@ -90,12 +90,6 @@ public string Name
9090
set { _name = value; }
9191
}
9292

93-
public DateTime Stamp
94-
{
95-
get { return _stamp; }
96-
set { _stamp = value; }
97-
}
98-
9993
public int X
10094
{
10195
get { return _x; }

src/NHibernate.DomainModel/MasterDetail.hbm.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
<!--TODO: make sure this type has an equiv .net type-->
1717
<version
18-
name="Stamp"
18+
name="stamp"
1919
type="Timestamp"
2020
column="ts_"
21+
access="field"
2122
/>
2223

2324
<property name="Name"/>

src/NHibernate.DomainModel/Simple.hbm.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<property name="Address" type="String" length="200" column="address" />
1010
<property name="Count" column="count_" not-null="true" unique="true"/>
1111
<property name="Date" column="date_"/>
12-
<many-to-one name="Other"/>
12+
<many-to-one name="Other" access="field.camelcase"/>
1313
</class>
1414

1515

0 commit comments

Comments
 (0)