Skip to content

Instantly share code, notes, and snippets.

@joakimriedel
Created August 9, 2019 20:48
Show Gist options
  • Save joakimriedel/01c76933faff57d4e790d33c310a57ae to your computer and use it in GitHub Desktop.
Save joakimriedel/01c76933faff57d4e790d33c310a57ae to your computer and use it in GitHub Desktop.
Assert in SpillSequenceSpiller
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.6" />
</ItemGroup>
</Project>
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace AssertRepro
{
class Program
{
static async Task Main(string[] args)
{
using (var context = new ClientContext())
{
var matches = await context.BillingGroups
.Select(bg => new MatchDto()
{
BillingGroup = bg
})
.ToListAsync();
}
}
public class BillingGroup
{
public int Id { get; set; }
}
public class MatchDto
{
public BillingGroup BillingGroup { get; set; }
}
class ClientContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString());
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
public DbSet<BillingGroup> BillingGroups { get; set; }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment