Skip to content

Commit 8302c54

Browse files
committed
Added alternative key
1 parent 3ca2afd commit 8302c54

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

DataLayer/SpecialisedEntities/Configurations/UserConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class UserConfig : IEntityTypeConfiguration<User>
1111
public void Configure
1212
(EntityTypeBuilder<User> entity)
1313
{
14+
entity.HasAlternateKey(p => p.Email);
15+
1416
entity
1517
.OwnsOne(e => e.HomeAddress)
1618
.ToTable("Addresses");

DataLayer/SpecialisedEntities/User.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public class User
99

1010
public string Name { get; set; }
1111

12+
public string Email { get; set; }
13+
1214
public Address HomeAddress { get; set; }
1315
}
1416
}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ See [Run SQL Script](https://github.com/JonPSmith/EfCore.TestSupport/wiki/7.-Run
3939
See [Capture EF Core logging](https://github.com/JonPSmith/EfCore.TestSupport/wiki/8.-Capture-EF-Core-logging).
4040
9. Tool to compare EF Core's view of the database with an actual database.
4141
See [EfSchemaCompare](https://github.com/JonPSmith/EfCore.TestSupport/wiki/9.-EfSchemaCompare).
42-
*NOTE: This is on beta release - it works, but I haven't tested all the possible EF Core mappings.*
4342

4443

4544

0 commit comments

Comments
 (0)