Skip to content

Commit 7d1ddd2

Browse files
committed
#66: Code to reproduce the issue.
1 parent 0223767 commit 7d1ddd2

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections.ObjectModel;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace SQLite.CodeFirst.Console.Entity
5+
{
6+
/// <summary>
7+
/// I agree, that this makes no sense.
8+
/// Its just to test the IsSelfReferencing method for table names which are shorter than 4 chars.
9+
/// See #66.
10+
/// </summary>
11+
public class Set
12+
{
13+
[Key]
14+
public string Title { get; set; }
15+
16+
public virtual Player Player { get; set; }
17+
}
18+
}

SQLite.CodeFirst.Console/FootballDbContext.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder)
1818
ConfigureStadionEntity(modelBuilder);
1919
ConfigureCoachEntity(modelBuilder);
2020
ConfigurePlayerEntity(modelBuilder);
21+
ConfigureSetEntity(modelBuilder);
2122

2223
var initializer = new FootballDbInitializer(modelBuilder);
2324
Database.SetInitializer(initializer);
@@ -56,5 +57,11 @@ private static void ConfigurePlayerEntity(DbModelBuilder modelBuilder)
5657
.WithMany(team => team.Players)
5758
.WillCascadeOnDelete(true);
5859
}
60+
61+
private static void ConfigureSetEntity(DbModelBuilder modelBuilder)
62+
{
63+
modelBuilder.Entity<Set>()
64+
.HasRequired(s => s.Player);
65+
}
5966
}
6067
}

SQLite.CodeFirst.Console/SQLite.CodeFirst.Console.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<Compile Include="Entity\IEntity.cs" />
8181
<Compile Include="Entity\Person.cs" />
8282
<Compile Include="Entity\Player.cs" />
83+
<Compile Include="Entity\Set.cs" />
8384
<Compile Include="Entity\Stadion.cs" />
8485
<Compile Include="Entity\Team.cs" />
8586
<Compile Include="FootballDbContext.cs" />

0 commit comments

Comments
 (0)