Skip to content

Instantly share code, notes, and snippets.

View joakimriedel's full-sized avatar

Joakim Riedel joakimriedel

View GitHub Profile
@joakimriedel
joakimriedel / Program.cs
Created September 6, 2018 12:01
AutoMapper bug with ProjectTo using nested projections containing FirstOrDefault
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
@joakimriedel
joakimriedel / EFCoreBug2.cs
Created September 7, 2018 09:09
EF Core bug with AsQueryable and expression filter
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace EfCoreBug2
@joakimriedel
joakimriedel / EfCoreBugSelectMany.cs
Created October 11, 2018 08:29
SelectMany with TPH and OfType throws System.ArgumentException
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace EfCoreBugSelectMany
@joakimriedel
joakimriedel / AssertRepro.csproj
Created August 9, 2019 20:48
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" />
@joakimriedel
joakimriedel / EfCoreBugExpression.csproj
Last active September 12, 2019 12:03
Ef Core 3.0 Expression Bug
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<!--<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
@joakimriedel
joakimriedel / Program.cs
Last active August 10, 2021 23:38
EF Core bug with null check in nested projection
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace EfCoreBug
@joakimriedel
joakimriedel / svgoLoader.ts
Created September 30, 2021 14:50
Plugin for svgo to set fill to currentColor
import svgToMiniDataURI from "mini-svg-data-uri";
import type { Plugin } from "rollup";
import fs from "fs";
import { optimize, OptimizeOptions } from "svgo";
type PluginOptions = { noOptimize?: boolean; svgo?: OptimizeOptions };
//TODO: remove this once https://github.com/vitejs/vite/pull/2909 gets merged
export const svgLoader: (options?: PluginOptions) => Plugin = (
options?: PluginOptions
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EfCoreBug
{
class Program
@joakimriedel
joakimriedel / Program.cs
Last active March 24, 2022 09:41
TPH Concat bug with EF Core 6
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EfCoreBug
{
class Program
@joakimriedel
joakimriedel / Program.cs
Created March 30, 2022 09:58
EF Core bug: Multiple counts in one select
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EfCoreBug
{
class Program