-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
23 lines (19 loc) · 838 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using EF.ComplexPropertyBug;
using EF.ComplexPropertyBug.Models;
using Microsoft.EntityFrameworkCore;
await using var bugDbContext = new BugDbContext(new DbContextOptionsBuilder<BugDbContext>()
.UseSqlServer("Server=localhost;Database=EFCoreComplexPropertyBug;User ID=sa;Password=superSecretBatterHorse!142;Encrypt=False;")
.Options);
bugDbContext.Database.EnsureDeleted();
bugDbContext.Database.EnsureCreated();
var shipment = new Shipment
{
Recipient = new Recipient
{
Address = new Address { Id = Id.CreateWithoutValidation<Address>(1) },
Customer = new Customer { Id = Id.CreateWithoutValidation<Customer>(2) },
Person = new Person { Id = Id.CreateWithoutValidation<Person>(3) }
}
};
var shipments = bugDbContext.Shipments.Where(s => s.Recipient == shipment.Recipient)
.ToList();