forked from npgsql/efcore.pg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManyToManyLoadNpgsqlTest.cs
More file actions
56 lines (46 loc) · 2.28 KB
/
Copy pathManyToManyLoadNpgsqlTest.cs
File metadata and controls
56 lines (46 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Microsoft.EntityFrameworkCore.TestModels.ManyToManyModel;
using Npgsql.EntityFrameworkCore.PostgreSQL.TestUtilities;
namespace Npgsql.EntityFrameworkCore.PostgreSQL;
public class ManyToManyLoadNpgsqlTest(ManyToManyLoadNpgsqlTest.ManyToManyLoadNpgsqlFixture fixture)
: ManyToManyLoadTestBase<ManyToManyLoadNpgsqlTest.ManyToManyLoadNpgsqlFixture>(fixture)
{
public class ManyToManyLoadNpgsqlFixture : ManyToManyLoadFixtureBase, ITestSqlLoggerFactory
{
public TestSqlLoggerFactory TestSqlLoggerFactory
=> (TestSqlLoggerFactory)ListLoggerFactory;
protected override ITestStoreFactory TestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
base.OnModelCreating(modelBuilder, context);
// We default to mapping DateTime to 'timestamp with time zone', but the seeding data has Unspecified DateTimes which aren't
// supported.
modelBuilder.Entity<EntityCompositeKey>()
.Property(e => e.Key3)
.HasColumnType("timestamp without time zone");
modelBuilder
.Entity<JoinOneSelfPayload>()
.Property(e => e.Payload)
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("NOW() AT TIME ZONE 'UTC'");
modelBuilder
.Entity<UnidirectionalEntityCompositeKey>()
.Property(e => e.Key3)
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("NOW() AT TIME ZONE 'UTC'");
modelBuilder
.Entity<UnidirectionalJoinOneSelfPayload>()
.Property(e => e.Payload)
.HasColumnType("timestamp without time zone")
.HasDefaultValueSql("NOW() AT TIME ZONE 'UTC'");
modelBuilder
.SharedTypeEntity<Dictionary<string, object>>("JoinOneToThreePayloadFullShared")
.IndexerProperty<string>("Payload")
.HasDefaultValue("Generated");
modelBuilder
.Entity<JoinOneToThreePayloadFull>()
.Property(e => e.Payload)
.HasDefaultValue("Generated");
}
}
}