Skip to content

Commit c885de2

Browse files
wisepotatomaurei
authored andcommitted
.NET Core 2.2 -> 3.0 (#597)
* merge: merge into correct email: * feat: upgrade to 2.2 * chore: spacing fix * chore: revert silencing error * chore: small spacing fix * chore: remove unneeeded dependencies * chore: fix framework dependencies * chore: updates * chore: test fixes * chore: start integration tests * chore: cleanup name of dertest * chore: start of getRepostory * chore: upgrade testsdk version + xunit version * feat: use template in version control of packages in integrationTests * feat: unit test assemblyinfo add, port old test to integration (attribute updater) * docs: add version compatibility * chore: add asterisk for version number * feat: port defaultentityrepositorytests to integration tests * chore: should add logging, done. * tests: bad response from tests * chore: fixes for lang version and making ifs more noticable * fix: fix routing issue with upgrade to enableendpointrouting * chore: HostEnvironment -> IWebHostEnvironment * chore: act -> Act, assert -> Assert, arrange -> Arrange * chore: fix tests * chore: re-add unit test for defaultentityrepository for test IAsyncQueryProvider that's actually a List * refactor: make if statements more conscise * chore: final stretch * tests: revert for good tests * Revert "tests: revert for good tests" This reverts commit 98b1119. * Revert "chore: final stretch" This reverts commit d6f763f. * fix: client generated id tests * fix: create data tests with workaround for efcore 3.0 bug * refactor: DetachRelationships usage of is operator * fix: move MetaStartup to other assembly as .net core 3 bug workaround * fix: UpdatingRelationshipTests locally evaluated queries error * feat: reintroduced generic processor (RepositoryRelationshipUpdateHelper) to fix locally evaluated expressions issue * feat: full sql support for UpdateRelationshipsAsync using expression trees * fix: DeletingDataTest * fix: paging test * fix: paging unit tests * chore: remove RE-split models, duplicate models to NoEntityFrameworkExample * fix: NoEntityFrameworkExample tests fixed by workaround assembly problem * fix: connection string e2e test projects * chore: minor cleanup * chore: minor cleanup * chore: cleanup
1 parent 5281350 commit c885de2

File tree

142 files changed

+2186
-2045
lines changed

Some content is hidden

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

142 files changed

+2186
-2045
lines changed

Directory.Build.props

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
<Project>
2-
32
<PropertyGroup>
4-
<NetCoreAppVersion>netcoreapp2.2</NetCoreAppVersion>
5-
<NetStandardVersion>netstandard2.0</NetStandardVersion>
6-
<AspNetCoreVersion>2.2.*</AspNetCoreVersion>
7-
<MicrosoftLoggingVersion>2.2.*</MicrosoftLoggingVersion>
8-
<MicrosoftConfigurationVersion>2.2.*</MicrosoftConfigurationVersion>
9-
<MicrosoftOptionsVersion>2.2.*</MicrosoftOptionsVersion>
10-
<EFCoreVersion>2.2.*</EFCoreVersion>
11-
<EFCoreToolsVersion>2.2.*</EFCoreToolsVersion>
12-
<NpgsqlVersion>4.0.0</NpgsqlVersion>
13-
<NpgsqlPostgreSQLVersion>2.1.0</NpgsqlPostgreSQLVersion>
3+
<NetCoreAppVersion>netcoreapp3.0</NetCoreAppVersion>
4+
<NetStandardVersion>netstandard2.1</NetStandardVersion>
5+
<AspNetCoreVersion>3.*</AspNetCoreVersion>
6+
<MicrosoftLoggingVersion>3.*</MicrosoftLoggingVersion>
7+
<MicrosoftConfigurationVersion>3.*</MicrosoftConfigurationVersion>
8+
<MicrosoftOptionsVersion>3.*</MicrosoftOptionsVersion>
9+
<EFCoreVersion>3.*</EFCoreVersion>
10+
<EFCoreToolsVersion>3.*</EFCoreToolsVersion>
11+
<NpgsqlVersion>4.1.1</NpgsqlVersion>
12+
<NpgsqlPostgreSQLVersion>3.0.1</NpgsqlPostgreSQLVersion>
1413
<TuplesVersion>4.5.0</TuplesVersion>
1514
</PropertyGroup>
1615

1716
<!-- Test Project Dependencies -->
1817
<PropertyGroup>
19-
<TestSdkVersion>15.7.2</TestSdkVersion>
20-
<XUnitVersion>2.3.1</XUnitVersion>
21-
<BogusVersion>22.1.2</BogusVersion>
22-
<MoqVersion>4.8.3</MoqVersion>
18+
<TestSdkVersion>16.3.0</TestSdkVersion>
19+
<XUnitVersion>2.4.1</XUnitVersion>
20+
<BogusVersion>28.4.1</BogusVersion>
21+
<MoqVersion>4.13.1</MoqVersion>
2322
</PropertyGroup>
2423
</Project>

JsonApiDotnetCore.sln

+15
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore", "src\Js
4141
EndProject
4242
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GettingStarted", "src\Examples\GettingStarted\GettingStarted.csproj", "{067FFD7A-C66B-473D-8471-37F5C95DF61C}"
4343
EndProject
44+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests", "test\IntegrationTests\IntegrationTests.csproj", "{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}"
45+
EndProject
4446
Global
4547
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4648
Debug|Any CPU = Debug|Any CPU
@@ -158,6 +160,18 @@ Global
158160
{067FFD7A-C66B-473D-8471-37F5C95DF61C}.Release|x64.Build.0 = Release|Any CPU
159161
{067FFD7A-C66B-473D-8471-37F5C95DF61C}.Release|x86.ActiveCfg = Release|Any CPU
160162
{067FFD7A-C66B-473D-8471-37F5C95DF61C}.Release|x86.Build.0 = Release|Any CPU
163+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
164+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
165+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x64.ActiveCfg = Debug|Any CPU
166+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x64.Build.0 = Debug|Any CPU
167+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x86.ActiveCfg = Debug|Any CPU
168+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Debug|x86.Build.0 = Debug|Any CPU
169+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
170+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|Any CPU.Build.0 = Release|Any CPU
171+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x64.ActiveCfg = Release|Any CPU
172+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x64.Build.0 = Release|Any CPU
173+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x86.ActiveCfg = Release|Any CPU
174+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9}.Release|x86.Build.0 = Release|Any CPU
161175
EndGlobalSection
162176
GlobalSection(SolutionProperties) = preSolution
163177
HideSolutionNode = FALSE
@@ -173,6 +187,7 @@ Global
173187
{789085E1-048F-4996-B600-791B9CA3A663} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
174188
{8BCFF95F-4850-427C-AEDB-B5B4F62B2C7B} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
175189
{21D27239-138D-4604-8E49-DCBE41BCE4C8} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
190+
{CEB08B86-6BF1-4227-B20F-45AE9C1CC6D9} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
176191
EndGlobalSection
177192
GlobalSection(ExtensibilityGlobals) = postSolution
178193
SolutionGuid = {A2421882-8F0A-4905-928F-B550B192F9A4}

README.md

+21-8
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ public class Article : Identifiable
5353
```csharp
5454
public class ArticlesController : JsonApiController<Article>
5555
{
56-
public ArticlesController(
57-
IJsonApiContext jsonApiContext,
58-
IResourceService<Article> resourceService)
59-
: base(jsonApiContext, resourceService) { }
56+
public ArticlesController(
57+
IJsonApiOptions jsonApiOptions,
58+
IResourceService<Article> resourceService,
59+
ILoggerFactory loggerFactory)
60+
: base(jsonApiOptions, resourceService, loggerFactory)
61+
{ }
6062
}
6163
```
6264

@@ -79,19 +81,18 @@ public class Startup
7981

8082
### Development
8183

82-
Restore all nuget packages with:
84+
Restore all NuGet packages with:
8385

8486
```bash
8587
dotnet restore
8688
```
8789

8890
#### Testing
8991

90-
Running tests locally requires access to a postgresql database.
91-
If you have docker installed, this can be propped up via:
92+
Running tests locally requires access to a PostgreSQL database. If you have docker installed, this can be propped up via:
9293

9394
```bash
94-
docker run --rm --name jsonapi-dotnet-core-testing -e POSTGRES_DB=JsonApiDotNetCoreExample -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres
95+
docker run --rm --name jsonapi-dotnet-core-testing -e POSTGRES_DB=JsonApiDotNetCoreExample -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres
9596
```
9697

9798
And then to run the tests:
@@ -107,3 +108,15 @@ Sometimes the compiled files can be dirty / corrupt from other branches / failed
107108
```bash
108109
dotnet clean
109110
```
111+
112+
113+
## Compatibility
114+
115+
A lot of changes were introduced in v4.0.0, the following chart should help you with compatibility issues between .NET Core versions
116+
117+
| .NET Core Version | JADNC Version |
118+
| ----------------- | ------------- |
119+
| 2.0 - 2.2 | v3.* |
120+
| 3.* | v4.* |
121+
122+

src/Examples/GettingStarted/GettingStarted.csproj

+1-2
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.0</TargetFramework>
4+
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -14,7 +14,6 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
1817
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
1918
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EFCoreVersion)" />
2019
</ItemGroup>

src/Examples/GettingStarted/Startup.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Microsoft.AspNetCore.Builder;
2-
using Microsoft.AspNetCore.Hosting;
1+
using Microsoft.AspNetCore.Builder;
32
using Microsoft.Extensions.DependencyInjection;
43
using Microsoft.EntityFrameworkCore;
54
using JsonApiDotNetCore.Extensions;
@@ -21,11 +20,9 @@ public void ConfigureServices(IServiceCollection services)
2120
discover => discover.AddCurrentAssembly(), mvcBuilder: mvcBuilder);
2221
}
2322

24-
public void Configure(IApplicationBuilder app, IHostingEnvironment env, SampleDbContext context)
23+
public void Configure(IApplicationBuilder app, SampleDbContext context)
2524
{
2625
context.Database.EnsureDeleted(); // indicies need to be reset
27-
context.Database.EnsureCreated();
28-
2926
app.UseJsonApi();
3027
}
3128
}

src/Examples/JsonApiDotNetCoreExample/Data/AppDbContext.cs

-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using JsonApiDotNetCoreExample.Models;
22
using Microsoft.EntityFrameworkCore;
3-
using JsonApiDotNetCoreExample.Models.Entities;
43

54
namespace JsonApiDotNetCoreExample.Data
65
{
@@ -25,19 +24,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
2524
.WithMany(p => p.TodoItems)
2625
.HasForeignKey(t => t.OwnerId);
2726

28-
modelBuilder.Entity<CourseStudentEntity>()
29-
.HasKey(r => new { r.CourseId, r.StudentId });
30-
31-
modelBuilder.Entity<CourseStudentEntity>()
32-
.HasOne(r => r.Course)
33-
.WithMany(c => c.Students)
34-
.HasForeignKey(r => r.CourseId);
35-
36-
modelBuilder.Entity<CourseStudentEntity>()
37-
.HasOne(r => r.Student)
38-
.WithMany(s => s.Courses)
39-
.HasForeignKey(r => r.StudentId);
40-
4127
modelBuilder.Entity<ArticleTag>()
4228
.HasKey(bc => new { bc.ArticleId, bc.TagId });
4329

@@ -84,10 +70,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
8470
public DbSet<Author> Authors { get; set; }
8571
public DbSet<NonJsonApiResource> NonJsonApiResources { get; set; }
8672
public DbSet<User> Users { get; set; }
87-
public DbSet<CourseEntity> Courses { get; set; }
88-
public DbSet<DepartmentEntity> Departments { get; set; }
89-
public DbSet<CourseStudentEntity> Registrations { get; set; }
90-
public DbSet<StudentEntity> Students { get; set; }
9173
public DbSet<PersonRole> PersonRoles { get; set; }
9274
public DbSet<ArticleTag> ArticleTags { get; set; }
9375
public DbSet<IdentifiableArticleTag> IdentifiableArticleTags { get; set; }

src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
1716
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="$(EFCoreVersion)" />
1817
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="$(EFCoreVersion)" />
1918
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftConfigurationVersion)" />
@@ -29,4 +28,7 @@
2928
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
3029
</ItemGroup>
3130

31+
<ItemGroup>
32+
<Folder Include="Startups\" />
33+
</ItemGroup>
3234
</Project>

src/Examples/JsonApiDotNetCoreExample/Models/Entities/CourseEntity.cs

-31
This file was deleted.

src/Examples/JsonApiDotNetCoreExample/Models/Entities/CourseStudentEntity.cs

-50
This file was deleted.

src/Examples/JsonApiDotNetCoreExample/Models/Entities/DepartmentEntity.cs

-17
This file was deleted.

src/Examples/JsonApiDotNetCoreExample/Models/Entities/StudentEntity.cs

-25
This file was deleted.

src/Examples/JsonApiDotNetCoreExample/Models/Resources/CourseResource.cs

-28
This file was deleted.

0 commit comments

Comments
 (0)