Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 6dbf2e7

Browse files
committed
rename table to avoid conflict
1 parent 67a1704 commit 6dbf2e7

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/ServiceStack.OrmLite.Tests/Expression/ComplexJoinTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace ServiceStack.OrmLite.Tests.Expression
1010
{
11-
public class Bar : IHasGuidId
11+
public class BarJoin : IHasGuidId
1212
{
1313
[PrimaryKey]
1414
public Guid Id { get; set; }
@@ -26,7 +26,7 @@ public class FooBar : IHasIntId
2626
// And a foreign key to the foo table as well, but that is not necessary to show the problem.
2727

2828
[Alias("fkBarId")]
29-
[ForeignKey(typeof(Bar), ForeignKeyName = "fk_FooBar_Bar")]
29+
[ForeignKey(typeof(BarJoin), ForeignKeyName = "fk_FooBar_Bar")]
3030
public Guid BarId { get; set; }
3131
}
3232

@@ -69,10 +69,10 @@ internal class JoinResult
6969
[BelongTo(typeof(FooBarBaz))]
7070
public decimal Amount { get; set; }
7171

72-
[BelongTo(typeof(Bar))]
72+
[BelongTo(typeof(BarJoin))]
7373
public Guid BarId { get; set; }
7474

75-
[BelongTo(typeof(Bar))]
75+
[BelongTo(typeof(BarJoin))]
7676
public string BarName { get; set; }
7777

7878
[BelongTo(typeof(Baz))]
@@ -132,19 +132,19 @@ private static void InitTables(IDbConnection db)
132132
{
133133
db.DropTable<FooBarBaz>();
134134
db.DropTable<FooBar>();
135-
db.DropTable<Bar>();
135+
db.DropTable<BarJoin>();
136136
db.DropTable<Baz>();
137137

138138
db.CreateTable<Baz>();
139-
db.CreateTable<Bar>();
139+
db.CreateTable<BarJoin>();
140140
db.CreateTable<FooBar>();
141141
db.CreateTable<FooBarBaz>();
142142

143143
var bar1Id = new Guid("5bd67b84-bfdb-4057-9799-5e7a72a6eaa9");
144144
var bar2Id = new Guid("a8061d08-6816-4e1e-b3d7-1178abcefa0d");
145145

146-
db.Insert(new Bar { Id = bar1Id, Name = "Banana", });
147-
db.Insert(new Bar { Id = bar2Id, Name = "Orange", });
146+
db.Insert(new BarJoin { Id = bar1Id, Name = "Banana", });
147+
db.Insert(new BarJoin { Id = bar2Id, Name = "Orange", });
148148

149149
db.Insert(new Baz { Id = 1, Name = "Large" });
150150
db.Insert(new Baz { Id = 2, Name = "Huge" });
@@ -166,7 +166,7 @@ public void ComplexJoin_with_JoinSqlBuilder()
166166

167167
/* This gives the expected values for BazId */
168168
var jn = new JoinSqlBuilder<JoinResult, FooBar>()
169-
.Join<FooBar, Bar>(
169+
.Join<FooBar, BarJoin>(
170170
sourceColumn: dp => dp.BarId,
171171
destinationColumn: p => p.Id,
172172
destinationTableColumnSelection: p => new { BarName = p.Name, BarId = p.Id })
@@ -202,7 +202,7 @@ public void ComplexJoin_with_SqlExpression()
202202
InitTables(db);
203203

204204
var q = db.From<FooBar>()
205-
.Join<Bar>((dp, p) => dp.BarId == p.Id)
205+
.Join<BarJoin>((dp, p) => dp.BarId == p.Id)
206206
.Join<FooBarBaz>((dp, dpss) => dp.Id == dpss.FooBarId)
207207
.Join<FooBarBaz, Baz>((dpss, ss) => dpss.BazId == ss.Id);
208208

0 commit comments

Comments
 (0)