|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | + |
| 4 | +using Microsoft.EntityFrameworkCore; |
| 5 | + |
| 6 | +namespace EFCoreAotQueriesBenchmarks |
| 7 | +{ |
| 8 | + public class EFCoreAotBenchmarkContext : DbContext |
| 9 | + { |
| 10 | + public static bool OnModelCreatingRan { get; set; } = false; |
| 11 | + |
| 12 | + public DbSet<MyEntity0> Entities0 { get; set; } = null!; |
| 13 | + public DbSet<MyEntity1> Entities1 { get; set; } = null!; |
| 14 | + public DbSet<MyEntity2> Entities2 { get; set; } = null!; |
| 15 | + public DbSet<MyEntity3> Entities3 { get; set; } = null!; |
| 16 | + public DbSet<MyEntity4> Entities4 { get; set; } = null!; |
| 17 | + public DbSet<MyEntity5> Entities5 { get; set; } = null!; |
| 18 | + public DbSet<MyEntity6> Entities6 { get; set; } = null!; |
| 19 | + public DbSet<MyEntity7> Entities7 { get; set; } = null!; |
| 20 | + public DbSet<MyEntity8> Entities8 { get; set; } = null!; |
| 21 | + public DbSet<MyEntity9> Entities9 { get; set; } = null!; |
| 22 | + |
| 23 | + protected override void OnModelCreating(ModelBuilder modelBuilder) |
| 24 | + { |
| 25 | + OnModelCreatingRan = true; |
| 26 | + |
| 27 | + modelBuilder.Entity<MyEntity0>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 28 | + modelBuilder.Entity<MyEntity1>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 29 | + modelBuilder.Entity<MyEntity2>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 30 | + modelBuilder.Entity<MyEntity3>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 31 | + modelBuilder.Entity<MyEntity4>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 32 | + modelBuilder.Entity<MyEntity5>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 33 | + modelBuilder.Entity<MyEntity6>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 34 | + modelBuilder.Entity<MyEntity7>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 35 | + modelBuilder.Entity<MyEntity8>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 36 | + modelBuilder.Entity<MyEntity9>().OwnsMany(x => x.Owned, b => { b.ToJson(); }); |
| 37 | + } |
| 38 | + |
| 39 | + protected override void OnConfiguring(DbContextOptionsBuilder options) |
| 40 | + => options.UseSqlite($"Data Source=efcoreaotbenchmark.db"); |
| 41 | + } |
| 42 | +} |
0 commit comments