Skip to content

Commit

Permalink
Added DateOnly and put #if_NET8 around the if block. Also removed the…
Browse files Browse the repository at this point in the history
… weird lines from the csproj
  • Loading branch information
anasik committed Jul 25, 2024
1 parent c126703 commit cfd9ae0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ internal Expression ProjectAsWrapper(QueryBinderContext context, Expression sour
bool isCollection, isPrimitiveCollection = false;
isCollection = TypeHelper.IsCollection(source.Type, out elementType);

#if NET8_0_OR_GREATER
if (isCollection)
{
if (elementType == typeof(string)
|| elementType == typeof(Uri)
|| elementType == typeof(DateTime)
|| elementType == typeof(DateOnly)
|| elementType == typeof(DateTimeOffset)
|| elementType == typeof(int)
|| elementType == typeof(uint)
Expand All @@ -124,6 +126,7 @@ internal Expression ProjectAsWrapper(QueryBinderContext context, Expression sour
isPrimitiveCollection = true;
}
}
#endif
QueryBinderContext subContext = new QueryBinderContext(context, context.QuerySettings, elementType);
if (computeClause != null && IsAvailableODataQueryOption(context.QuerySettings, AllowedQueryOptions.Compute))
{
Expand All @@ -139,7 +142,7 @@ internal Expression ProjectAsWrapper(QueryBinderContext context, Expression sour
&& !isPrimitiveCollection
)
{

// new CollectionWrapper<ElementType> { Instance = source.Select(s => new Wrapper { ... }) };
return ProjectCollection(subContext, source, elementType, selectExpandClause, structuredType, navigationSource, orderByClause,
topOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
<Compile Remove="Commons\Interfaces\**" />
<EmbeddedResource Remove="Commons\Interfaces\**" />
<None Remove="Commons\Interfaces\**" />
<None Remove="Lists\*.db" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.OData.ModelBuilder" Version="1.0.9" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include=" Microsoft.AspNetCore.Mvc.Testing" Version=" 3.1.7" />
<PackageReference Include=" Microsoft.NET.Test.Sdk" Version=" 17.0.0" />
<PackageReference Include=" Microsoft.OData.ModelBuilder" Version=" 1.0.9" />
<PackageReference Include=" Moq" Version=" 4.13.1" />
<PackageReference Include=" xunit" Version=" 2.3.1" />
<PackageReference Include=" xunit.runner.visualstudio" Version=" 2.3.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' ">
Expand Down Expand Up @@ -54,7 +53,4 @@
<ProjectReference
Include="..\Microsoft.AspNetCore.OData.TestCommon\Microsoft.AspNetCore.OData.TestCommon.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Lists\" />
</ItemGroup>
</Project>

0 comments on commit cfd9ae0

Please sign in to comment.