Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.EntityFrameworkCore;

namespace EFCoreAotQueriesBenchmarks
{
public class EFCoreAotBenchmarkContext : DbContext
{
public static bool OnModelCreatingRan { get; set; } = false;

public DbSet<MyEntity0> Entities0 { get; set; } = null!;
public DbSet<MyEntity1> Entities1 { get; set; } = null!;
public DbSet<MyEntity2> Entities2 { get; set; } = null!;
public DbSet<MyEntity3> Entities3 { get; set; } = null!;
public DbSet<MyEntity4> Entities4 { get; set; } = null!;
public DbSet<MyEntity5> Entities5 { get; set; } = null!;
public DbSet<MyEntity6> Entities6 { get; set; } = null!;
public DbSet<MyEntity7> Entities7 { get; set; } = null!;
public DbSet<MyEntity8> Entities8 { get; set; } = null!;
public DbSet<MyEntity9> Entities9 { get; set; } = null!;

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
OnModelCreatingRan = true;

modelBuilder.Entity<MyEntity0>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity1>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity2>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity3>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity4>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity5>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity6>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity7>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity8>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
modelBuilder.Entity<MyEntity9>().OwnsMany(x => x.Owned, b => { b.ToJson(); });
}

protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=efcoreaotbenchmark.db");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<SelfContained>true</SelfContained>
<InvariantGlobalization>false</InvariantGlobalization>
<PublishAot>true</PublishAot>
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.EntityFrameworkCore.GeneratedInterceptors</InterceptorsPreviewNamespaces>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<Optimize>true</Optimize>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tasks" Version="9.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.10" />
</ItemGroup>

<ItemGroup>
<None Update="efcoreaotbenchmark.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</None>
</ItemGroup>

</Project>
Loading
Loading