Skip to content

Commit 09b8a75

Browse files
pamidurKyryloLehonkovKyrylo LehonkovKyrylo Lehonkov
authored
So many stuff (#12)
* made root context implicit * introduced ContextTerm * wip on linq provider * fixed pick boolean method * fixed lambda argument resolution * Immutable assembler, removed implicit expression blocks, new EmitContainer, tmp disabled nullable linq-to-objects hack, * reverted OdataSample project to netcore2.1 * replaced immutabledict with immutablearray to preserve args order * better expression naming, disabled proxy expr stripping * updated dependencies, added some e2e tests * Update dotnetcore.yml * updated projects refs, min asp support = 3.1 * Update dotnetcore.yml * odata parser return strings for decimal and ints; prepare test case for nullable dateTime (#14) Co-authored-by: Kyrylo Lehonkov <[email protected]> * fixed test runners * Update dotnetcore.yml * fixed nullables * faster approach for nullables * now targeting netstandard2.1 * code cleanup * improved linq implementation * updated dependencies * fixed issue with closed Response.Body stream (#16) Co-authored-by: Kyrylo Lehonkov <[email protected]> --------- Co-authored-by: Kyrylo Lehonkov <[email protected]> Co-authored-by: Kyrylo Lehonkov <[email protected]> Co-authored-by: Kyrylo Lehonkov <[email protected]>
1 parent c8db7f3 commit 09b8a75

File tree

94 files changed

+2234
-1255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2234
-1255
lines changed

.gitattributes

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
# no eol conversions!
5+
* -text
6+
7+
###############################################################################
8+
# Set default behavior for command prompt diff.
9+
#
10+
# This is need for earlier builds of msysgit that does not have it on by
11+
# default for csharp files.
12+
# Note: This is only used by command line
13+
###############################################################################
14+
#*.cs diff=csharp
15+
16+
###############################################################################
17+
# Set the merge driver for project and solution files
18+
#
19+
# Merging from the command prompt will add diff markers to the files if there
20+
# are conflicts (Merging from VS is not affected by the settings below, in VS
21+
# the diff markers are never inserted). Diff markers may cause the following
22+
# file extensions to fail to load in VS. An alternative would be to treat
23+
# these files as binary and thus will always conflict and require user
24+
# intervention with every merge. To do so, just uncomment the entries below
25+
###############################################################################
26+
#*.sln merge=binary
27+
#*.csproj merge=binary
28+
#*.vbproj merge=binary
29+
#*.vcxproj merge=binary
30+
#*.vcproj merge=binary
31+
#*.dbproj merge=binary
32+
#*.fsproj merge=binary
33+
#*.lsproj merge=binary
34+
#*.wixproj merge=binary
35+
#*.modelproj merge=binary
36+
#*.sqlproj merge=binary
37+
#*.wwaproj merge=binary
38+
39+
###############################################################################
40+
# behavior for image files
41+
#
42+
# image files are treated as binary by default.
43+
###############################################################################
44+
#*.jpg binary
45+
#*.png binary
46+
#*.gif binary
47+
48+
###############################################################################
49+
# diff behavior for common document formats
50+
#
51+
# Convert binary document formats to text before diffing them. This feature
52+
# is only available from the command line. Turn it on by uncommenting the
53+
# entries below.
54+
###############################################################################
55+
#*.doc diff=astextplain
56+
#*.DOC diff=astextplain
57+
#*.docx diff=astextplain
58+
#*.DOCX diff=astextplain
59+
#*.dot diff=astextplain
60+
#*.DOT diff=astextplain
61+
#*.pdf diff=astextplain
62+
#*.PDF diff=astextplain
63+
#*.rtf diff=astextplain
64+
#*.RTF diff=astextplain

.github/workflows/dotnetcore.yml

+40-33
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,52 @@
11
name: Main
22
env:
3-
NUGETURL: https://api.nuget.org/v3/index.json
4-
NUGET_TOKEN: ${{ secrets.nuget }}
5-
MODE: Release
6-
CODACY_TOKEN: ${{ secrets.codacy }}
7-
8-
on: [push]
3+
app_release: false
4+
app_conf: Release
5+
nuget_url: https://api.nuget.org/v3/index.json
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
tags:
12+
- '**'
13+
pull_request:
914

1015
jobs:
1116
build:
12-
1317
runs-on: ubuntu-latest
14-
1518
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
submodules: true
22+
fetch-depth: 0
23+
- uses: actions/setup-dotnet@v1
24+
with:
25+
dotnet-version: 3.1.x
26+
- uses: actions/setup-dotnet@v1
27+
with:
28+
dotnet-version: 6.0.x
1629
- name: Configure
1730
run: |
18-
TAG=$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF:10} || echo "")
19-
VERSION=${TAG:-0.0.0-dev}
20-
echo ::set-env name=TAG::$TAG
21-
echo ::set-env name=VERSION::$VERSION
22-
echo ::set-env name=VERSIONFULL::$(echo $VERSION:$GITHUB_SHA)
23-
echo ::set-env name=ISRELEASE::$(test -z "$TAG")
24-
- name: Checkout
25-
uses: actions/checkout@v1
26-
- name: Setup .NET Core
27-
uses: actions/setup-dotnet@v1
28-
with:
29-
dotnet-version: 2.2.402
31+
echo "app_version=`git describe --tags`" >> $GITHUB_ENV
32+
echo "app_release=`(git describe --tags --exact-match>/dev/null 2>&1 && echo true) || echo false`" >> $GITHUB_ENV
33+
- name: Status
34+
run: echo "Release=$app_release, version=$app_version"
3035
- name: Build
31-
run: dotnet build ./ -c $MODE -p:Version=$VERSION -p:InformationalVersion=$VERSIONFULL
36+
run: dotnet build -c $app_conf -p:Version=$app_version -p:InformationalVersion="$app_version:$GITHUB_SHA"
3237
- name: Test
33-
run: dotnet test ./ -c $MODE --no-build
34-
- name: Submit coverage
35-
run: |
36-
curl -Ls "https://github.com/codacy/csharp-codacy-coverage/releases/download/1.0.7/Codacy.CSharpCoverage_linux-x64" --output codacy
37-
chmod +x ./codacy
38-
coverfiles=$(find . -type f -name coverage.opencover.xml)
39-
for coverfile in $coverfiles; do
40-
./codacy -c $GITHUB_SHA -t $CODACY_TOKEN -r "$coverfile" -e opencover -p
41-
done
42-
if [ -n "$coverfiles" ]; then
43-
./codacy -c $GITHUB_SHA -t $CODACY_TOKEN -f
44-
fi
38+
run: dotnet test -c $app_conf --no-build
39+
- name: Pack
40+
run: dotnet pack -c $app_conf --no-build -o ./artifacts -p:Version=$app_version -p:CommitSHA=$GITHUB_SHA
41+
- uses: actions/upload-artifact@v1
42+
with:
43+
name: artifacts
44+
path: ./artifacts
45+
- name: Publish
46+
if: env.app_release == 'true'
47+
env:
48+
NUGETKEY: ${{ secrets.NUGET_KEY }}
49+
working-directory: ./artifacts
50+
run: dotnet nuget push *.nupkg -s $nuget_url -k $NUGETKEY
51+
4552

.travis.yml

-33
This file was deleted.

Directory.Build.targets

-5
This file was deleted.

QRest.sln

100644100755
+10-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27004.2002
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32112.339
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2EC1DEC4-46D5-4A50-B6D4-A031FFC1D1F5}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CAA9FEEA-7A2A-41FB-9423-DDFC633830ED}"
9+
ProjectSection(SolutionItems) = preProject
10+
test\Directory.Build.props = test\Directory.Build.props
11+
test\Directory.Build.targets = test\Directory.Build.targets
12+
EndProjectSection
913
EndProject
1014
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRest.AspNetCore", "src\QRest.AspNetCore\QRest.AspNetCore.csproj", "{B1F307E4-905C-44F3-ADCD-4D2C85645C48}"
1115
EndProject
@@ -20,26 +24,16 @@ EndProject
2024
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".solution", ".solution", "{68EFFEF7-800B-4592-BE7B-9D9568083814}"
2125
ProjectSection(SolutionItems) = preProject
2226
.gitignore = .gitignore
27+
Directory.Build.props = Directory.Build.props
28+
.github\workflows\dotnetcore.yml = .github\workflows\dotnetcore.yml
29+
LICENSE = LICENSE
30+
README.md = README.md
2331
EndProjectSection
2432
EndProject
2533
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRest.Semantics.OData", "src\QRest.Semantics.OData\QRest.Semantics.OData.csproj", "{F6B5672A-F0E1-4D0D-9E5C-31CB4F50DC90}"
2634
EndProject
2735
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRest.Semantics.OData.Tests", "test\QRest.Semantics.OData.Tests\QRest.Semantics.OData.Tests.csproj", "{12DB82BA-C9AE-43DC-8181-9A33F4FAC55F}"
2836
EndProject
29-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{F592F579-DB0F-4E74-B79D-D921DEDBE4B2}"
30-
ProjectSection(SolutionItems) = preProject
31-
LICENSE = LICENSE
32-
README.md = README.md
33-
EndProjectSection
34-
EndProject
35-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{3D211EBB-5B03-4FDF-B7BA-E1B36958F523}"
36-
ProjectSection(SolutionItems) = preProject
37-
.travis.yml = .travis.yml
38-
after.QRest.sln.targets = after.QRest.sln.targets
39-
Directory.Build.props = Directory.Build.props
40-
Directory.build.targets = Directory.build.targets
41-
EndProjectSection
42-
EndProject
4337
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRest.Compiler.Standard.Tests", "test\QRest.Compiler.Standard.Tests\QRest.Compiler.Standard.Tests.csproj", "{DA987B08-765B-46E2-ADB7-6D739B95A4F0}"
4438
EndProject
4539
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRest.AspNetCore.OData.Tests", "test\QRest.AspNetCore.OData.Tests\QRest.AspNetCore.OData.Tests.csproj", "{766A94A2-5A5C-45B9-94C9-A5B06338CEE8}"
@@ -99,8 +93,6 @@ Global
9993
{284FC041-7F0D-4F0C-8F49-71A52E92E46D} = {7D715283-67A8-43E2-938E-6CB12ACD30F8}
10094
{F6B5672A-F0E1-4D0D-9E5C-31CB4F50DC90} = {2EC1DEC4-46D5-4A50-B6D4-A031FFC1D1F5}
10195
{12DB82BA-C9AE-43DC-8181-9A33F4FAC55F} = {CAA9FEEA-7A2A-41FB-9423-DDFC633830ED}
102-
{F592F579-DB0F-4E74-B79D-D921DEDBE4B2} = {68EFFEF7-800B-4592-BE7B-9D9568083814}
103-
{3D211EBB-5B03-4FDF-B7BA-E1B36958F523} = {68EFFEF7-800B-4592-BE7B-9D9568083814}
10496
{DA987B08-765B-46E2-ADB7-6D739B95A4F0} = {CAA9FEEA-7A2A-41FB-9423-DDFC633830ED}
10597
{766A94A2-5A5C-45B9-94C9-A5B06338CEE8} = {CAA9FEEA-7A2A-41FB-9423-DDFC633830ED}
10698
{B20B30E5-98CB-4C33-805C-921DA5CFAAD4} = {7D715283-67A8-43E2-938E-6CB12ACD30F8}

after.QRest.sln.targets

-5
This file was deleted.

samples/ODataSamples/Controllers/MemoryController.cs

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
namespace ODataSamples.Controllers
88
{
99
[Route("api/[controller]")]
10-
[ApiController]
11-
public class MemoryController : ControllerBase
10+
public class MemoryController : Controller
1211
{
1312
[HttpGet("{query?}")]
1413
public ActionResult<IQueryable<Domain.Order>> Get(Query query)

samples/ODataSamples/ODataSamples.csproj

100644100755
+7-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<DockerTargetOS>Linux</DockerTargetOS>
66
</PropertyGroup>
77

@@ -10,11 +10,12 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.AspNetCore.App" />
14-
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
15-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.4" />
16-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.4.10" />
17-
<PackageReference Include="QRest.Semantics.OData" Version="0.4.3-beta" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.5" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.7" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\..\src\QRest.Semantics.OData\QRest.Semantics.OData.csproj" />
1819
</ItemGroup>
1920

2021
</Project>

samples/ODataSamples/Startup.cs

100644100755
+26-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
using Microsoft.EntityFrameworkCore;
55
using Microsoft.Extensions.Configuration;
66
using Microsoft.Extensions.DependencyInjection;
7+
using Microsoft.Extensions.Hosting;
78
using ODataSamples.Contexts;
9+
using System;
810

911
namespace ODataSamples
1012
{
@@ -19,8 +21,8 @@ public Startup(IConfiguration configuration)
1921

2022
public void ConfigureServices(IServiceCollection services)
2123
{
22-
services.AddDbContext<DataContext>(options =>
23-
options.UseSqlServer(Configuration.GetConnectionString("DatabaseCS")));
24+
services.
25+
AddDbContext<DataContext>(o => o.UseInMemoryDatabase("TestDb"));
2426

2527
services
2628
.AddQRest()
@@ -30,22 +32,31 @@ public void ConfigureServices(IServiceCollection services)
3032
cpl.UseCompilerCache = false;
3133
});
3234

33-
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
35+
services.AddControllers();
3436

3537
var resolver = services.BuildServiceProvider();
36-
var ctx = resolver.GetService<DataContext>();
37-
ctx.Database.Migrate();
38-
38+
var ctx = resolver.GetService<DataContext>();
39+
//ctx.Database.Migrate();
40+
3941
}
40-
41-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
42-
{
43-
if (env.IsDevelopment())
44-
{
45-
app.UseDeveloperExceptionPage();
46-
}
47-
48-
app.UseMvc();
42+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
43+
{
44+
45+
app.UseDeveloperExceptionPage();
46+
app.Use(async (context, next) =>
47+
{
48+
Console.WriteLine($"{context.Request.Path}{context.Request.QueryString}");
49+
await next.Invoke();
50+
});
51+
52+
app.UseRouting();
53+
54+
55+
app.UseODataMetadata();
56+
app.UseEndpoints(endpoints =>
57+
{
58+
endpoints.MapControllers();
59+
});
4960
}
5061
}
5162
}

0 commit comments

Comments
 (0)