Navigation Menu

Skip to content

Commit

Permalink
Renamed the Table overload which defined <join>s to actually be calle…
Browse files Browse the repository at this point in the history
…d Join
  • Loading branch information
jagregory committed Aug 4, 2009
1 parent 3109c19 commit 3ea8d85
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Expand Up @@ -364,7 +364,7 @@ public void CanSetSchema()
public void SpanningClassAcrossTwoTables() public void SpanningClassAcrossTwoTables()
{ {
new MappingTester<MappedObject>() new MappingTester<MappedObject>()
.ForMapping(m => m.Table("tableTwo", t => t.Map(x => x.Name))) .ForMapping(m => m.Join("tableTwo", t => t.Map(x => x.Name)))
.Element("class/join").Exists(); .Element("class/join").Exists();
} }


Expand Down
Expand Up @@ -10,23 +10,23 @@ public class JoinPartTester
public void CreatesJoinElement() public void CreatesJoinElement()
{ {
new MappingTester<JoinTarget>() new MappingTester<JoinTarget>()
.ForMapping(m => m.Table("myTable", t => t.Map(x => x.Name))) .ForMapping(m => m.Join("myTable", t => t.Map(x => x.Name)))
.Element("class/join").Exists(); .Element("class/join").Exists();
} }


[Test] [Test]
public void JoinElementHasTableName() public void JoinElementHasTableName()
{ {
new MappingTester<JoinTarget>() new MappingTester<JoinTarget>()
.ForMapping(m => m.Table("myTable", t => t.Map(x => x.Name))) .ForMapping(m => m.Join("myTable", t => t.Map(x => x.Name)))
.Element("class/join").HasAttribute("table", "myTable"); .Element("class/join").HasAttribute("table", "myTable");
} }


[Test] [Test]
public void PropertiesInJoinAreOutputInTheJoinElement() public void PropertiesInJoinAreOutputInTheJoinElement()
{ {
new MappingTester<JoinTarget>() new MappingTester<JoinTarget>()
.ForMapping(m => m.Table("myTable", t => t.Map(x => x.Name))) .ForMapping(m => m.Join("myTable", t => t.Map(x => x.Name)))
.Element("class/join/property").HasAttribute("name", "Name"); .Element("class/join/property").HasAttribute("name", "Name");
} }


Expand All @@ -37,7 +37,7 @@ public void PropertiesDefinedInClassAndPropertiesDefinedInJoinAreSeparateInOutpu
.ForMapping(m => .ForMapping(m =>
{ {
m.Map(x => x.Name); m.Map(x => x.Name);
m.Table("myTable", t => t.Map(x => x.CustomerName)); m.Join("myTable", t => t.Map(x => x.CustomerName));
}) })
.Element("class/property").HasAttribute("name", "Name") .Element("class/property").HasAttribute("name", "Name")
.Element("class/join/property").HasAttribute("name", "CustomerName"); .Element("class/join/property").HasAttribute("name", "CustomerName");
Expand All @@ -47,23 +47,23 @@ public void PropertiesDefinedInClassAndPropertiesDefinedInJoinAreSeparateInOutpu
public void JoinElementAlwaysHasAKey() public void JoinElementAlwaysHasAKey()
{ {
new MappingTester<JoinTarget>() new MappingTester<JoinTarget>()
.ForMapping(m => m.Table("myTable", t => t.Map(x => x.Name))) .ForMapping(m => m.Join("myTable", t => t.Map(x => x.Name)))
.Element("class/join/key").Exists(); .Element("class/join/key").Exists();
} }


[Test] [Test]
public void KeyDefaultsToClassNameId() public void KeyDefaultsToClassNameId()
{ {
new MappingTester<JoinTarget>() new MappingTester<JoinTarget>()
.ForMapping(m => m.Table("myTable", t => t.Map(x => x.Name))) .ForMapping(m => m.Join("myTable", t => t.Map(x => x.Name)))
.Element("class/join/key/column").HasAttribute("name", "JoinTargetID"); .Element("class/join/key/column").HasAttribute("name", "JoinTargetID");
} }


[Test] [Test]
public void CanOverrideKey() public void CanOverrideKey()
{ {
new MappingTester<JoinTarget>() new MappingTester<JoinTarget>()
.ForMapping(m => m.Table("myTable", t => t.KeyColumn("ID"))) .ForMapping(m => m.Join("myTable", t => t.KeyColumn("ID")))
.Element("class/join/key/column").HasAttribute("name", "ID"); .Element("class/join/key/column").HasAttribute("name", "ID");
} }


Expand All @@ -76,7 +76,7 @@ public void JoinIsAlwaysLastInTheClassElement()
{ {
m.Map(x => x.Name); m.Map(x => x.Name);
m.HasMany(x => x.Children); m.HasMany(x => x.Children);
m.Table("myTable", t => t.KeyColumn("ID")); m.Join("myTable", t => t.KeyColumn("ID"));
}) })
.Element("class/*[last()]").HasName("join"); .Element("class/*[last()]").HasName("join");
} }
Expand Down
2 changes: 1 addition & 1 deletion src/FluentNHibernate/Mapping/ClassMap.cs
Expand Up @@ -249,7 +249,7 @@ public void LazyLoad()
/// </summary> /// </summary>
/// <param name="tableName">Joined table name</param> /// <param name="tableName">Joined table name</param>
/// <param name="action">Joined table mapping</param> /// <param name="action">Joined table mapping</param>
public void Table(string tableName, Action<JoinPart<T>> action) public void Join(string tableName, Action<JoinPart<T>> action)
{ {
var join = new JoinPart<T>(tableName); var join = new JoinPart<T>(tableName);
action(join); action(join);
Expand Down

0 comments on commit 3ea8d85

Please sign in to comment.