Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes broken "INCLUDE/INCLUDEMANY" #494

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Program/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ private static QueryFactory SqlServerQueryFactory()
}

}
}
}
12 changes: 5 additions & 7 deletions Program/Program.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\QueryBuilder\QueryBuilder.csproj" />
<ProjectReference Include="..\SqlKata.Execution\SqlKata.Execution.csproj" />
Expand All @@ -12,10 +15,5 @@
<PackageReference Include="System.Data.SQLite" Version="1.0.109.2" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>


</Project>
10 changes: 6 additions & 4 deletions SqlKata.Execution/QueryFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ private static IEnumerable<T> handleIncludes<T>(Query query, IEnumerable<T> resu
}

var localIds = dynamicResult.Where(x => x[include.LocalKey] != null)
.Select(x => x[include.LocalKey].ToString())
.Select(x => x[include.LocalKey])
.ToList();

if (!localIds.Any())
Expand Down Expand Up @@ -731,7 +731,8 @@ private static IEnumerable<T> handleIncludes<T>(Query query, IEnumerable<T> resu

var foreignIds = dynamicResult
.Where(x => x[include.ForeignKey] != null)
.Select(x => x[include.ForeignKey].ToString())
// .Select(x => x[include.ForeignKey].ToString())
.Select(x => x[include.ForeignKey])
.ToList();

if (!foreignIds.Any())
Expand Down Expand Up @@ -799,7 +800,7 @@ private static async Task<IEnumerable<T>> handleIncludesAsync<T>(Query query, IE
}

var localIds = dynamicResult.Where(x => x[include.LocalKey] != null)
.Select(x => x[include.LocalKey].ToString())
.Select(x => x[include.LocalKey])
.ToList();

if (!localIds.Any())
Expand Down Expand Up @@ -828,7 +829,8 @@ private static async Task<IEnumerable<T>> handleIncludesAsync<T>(Query query, IE
}

var foreignIds = dynamicResult.Where(x => x[include.ForeignKey] != null)
.Select(x => x[include.ForeignKey].ToString())
// .Select(x => x[include.ForeignKey].ToString())
.Select(x => x[include.ForeignKey])
.ToList();

if (!foreignIds.Any())
Expand Down