Skip to content

Commit 5f4f5c5

Browse files
authored
Merge pull request #229 from json-api-dotnet/develop
[WIP] v2.2.0 Operations
2 parents 2374492 + 3b08bdb commit 5f4f5c5

File tree

91 files changed

+22388
-197
lines changed

Some content is hidden

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

91 files changed

+22388
-197
lines changed

.vscode/launch.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"name": "OperationsExample",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "${workspaceRoot}/src/Examples/OperationsExample/bin/Debug/netcoreapp1.0/OperationsExample.dll",
10+
"args": [],
11+
"cwd": "${workspaceRoot}/src/Examples/OperationsExample",
12+
"stopAtEntry": false
13+
},
414
{
515
"name": ".NET Core Attach",
616
"type": "coreclr",

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
"problemMatcher": "$msCompile"
1818
}
1919
]
20-
}
20+
}

Directory.Build.props

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
<Project>
22

33
<PropertyGroup>
4+
<NetCoreAppVersion>netcoreapp2.0</NetCoreAppVersion>
45
<NetStandardVersion>netstandard2.0</NetStandardVersion>
6+
57
<AspNetCoreVersion>2.0.1</AspNetCoreVersion>
6-
<EFCoreVersion>2.0.1</EFCoreVersion>
8+
79
<MicrosoftLoggingVersion>2.0.0</MicrosoftLoggingVersion>
810
<MicrosoftConfigurationVersion>2.0.0</MicrosoftConfigurationVersion>
11+
<MicrosoftOptionsVersion>2.0.0</MicrosoftOptionsVersion>
12+
13+
14+
<EFCoreVersion>2.0.1</EFCoreVersion>
15+
<EFCoreToolsVersion>2.0.1</EFCoreToolsVersion>
16+
17+
<NpgsqlVersion>3.2.6</NpgsqlVersion>
18+
<NpgsqlPostgreSQLVersion>2.0.0</NpgsqlPostgreSQLVersion>
19+
920
<TuplesVersion>4.4.0</TuplesVersion>
1021
</PropertyGroup>
1122

1223
<!-- Test Project Dependencies -->
1324
<PropertyGroup>
14-
<NetCoreAppVersion>netcoreapp2.0</NetCoreAppVersion>
15-
<MicrosoftOptionsVersion>2.0.0</MicrosoftOptionsVersion>
16-
<NpgsqlPostgreSQLVersion>2.0.0</NpgsqlPostgreSQLVersion>
17-
<NpgsqlVersion>3.2.6</NpgsqlVersion>
18-
<EFCoreToolsVersion>2.0.1</EFCoreToolsVersion>
1925
<TestSdkVersion>15.3.0-preview-20170427-09</TestSdkVersion>
2026
<TestHostVersion>1.1.2</TestHostVersion>
2127
<XUnitVersion>2.3.0-beta3-build3705</XUnitVersion>
2228
<BogusVersion>15.0.3</BogusVersion>
2329
<MoqVersion>4.7.99</MoqVersion>
2430
</PropertyGroup>
2531

26-
</Project>
32+
</Project>

JsonApiDotnetCore.sln

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks",
3232
EndProject
3333
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "benchmarks\Benchmarks.csproj", "{1F604666-BB0F-413E-922D-9D37C6073285}"
3434
EndProject
35+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OperationsExample", "src\Examples\OperationsExample\OperationsExample.csproj", "{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}"
36+
EndProject
37+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OperationsExampleTests", "test\OperationsExampleTests\OperationsExampleTests.csproj", "{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}"
38+
EndProject
3539
Global
3640
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3741
Debug|Any CPU = Debug|Any CPU
@@ -110,10 +114,34 @@ Global
110114
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x86.Build.0 = Debug|Any CPU
111115
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|Any CPU.ActiveCfg = Release|Any CPU
112116
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|Any CPU.Build.0 = Release|Any CPU
113-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.ActiveCfg = Release|Any CPU
114-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.Build.0 = Release|Any CPU
115-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.ActiveCfg = Release|Any CPU
116-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.Build.0 = Release|Any CPU
117+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.ActiveCfg = Release|x64
118+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.Build.0 = Release|x64
119+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.ActiveCfg = Release|x86
120+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.Build.0 = Release|x86
121+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
122+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Debug|Any CPU.Build.0 = Debug|Any CPU
123+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Debug|x64.ActiveCfg = Debug|x64
124+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Debug|x64.Build.0 = Debug|x64
125+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Debug|x86.ActiveCfg = Debug|x86
126+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Debug|x86.Build.0 = Debug|x86
127+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Release|Any CPU.ActiveCfg = Release|Any CPU
128+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Release|Any CPU.Build.0 = Release|Any CPU
129+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Release|x64.ActiveCfg = Release|x64
130+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Release|x64.Build.0 = Release|x64
131+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Release|x86.ActiveCfg = Release|x86
132+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D}.Release|x86.Build.0 = Release|x86
133+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
134+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
135+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Debug|x64.ActiveCfg = Debug|x64
136+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Debug|x64.Build.0 = Debug|x64
137+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Debug|x86.ActiveCfg = Debug|x86
138+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Debug|x86.Build.0 = Debug|x86
139+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
140+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Release|Any CPU.Build.0 = Release|Any CPU
141+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Release|x64.ActiveCfg = Release|x64
142+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Release|x64.Build.0 = Release|x64
143+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Release|x86.ActiveCfg = Release|x86
144+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1}.Release|x86.Build.0 = Release|x86
117145
{1F604666-BB0F-413E-922D-9D37C6073285}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
118146
{1F604666-BB0F-413E-922D-9D37C6073285}.Debug|Any CPU.Build.0 = Debug|Any CPU
119147
{1F604666-BB0F-413E-922D-9D37C6073285}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -139,6 +167,8 @@ Global
139167
{6D4BD85A-A262-44C6-8572-FE3A30410BF3} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
140168
{026FBC6C-AF76-4568-9B87-EC73457899FD} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
141169
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
170+
{CF2C1EB6-8449-4B35-B8C7-F43D6D90632D} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
171+
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
142172
{1F604666-BB0F-413E-922D-9D37C6073285} = {076E1AE4-FD25-4684-B826-CAAE37FEA0AA}
143173
EndGlobalSection
144174
GlobalSection(ExtensibilityGlobals) = postSolution

benchmarks/Benchmarks.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<Import Project="..\build\dependencies.props" />
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>

build/dependencies.props

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/Operations.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
currentMenu: operations
3+
---
4+
5+
# Operations
6+
7+
Operations is currently an unofficial proposal. It allows you to perform bulk operations in a single transaction.
8+
9+
### Enabling
10+
11+
To enable the operations extension, modify you `Startup.ConfigureServices` method:
12+
13+
```csharp
14+
services.AddJsonApi<AppDbContext>(opt => opt.EnableExtension(JsonApiExtension.Operations));
15+
```
16+
17+
### Controllers
18+
19+
To create a bulk operations controller, inherit `JsonApiOperationsController`:
20+
21+
```csharp
22+
[Route("api/bulk")]
23+
public class OperationsController : JsonApiOperationsController
24+
{
25+
public OperationsController(IOperationsProcessor processor)
26+
: base(processor)
27+
{ }
28+
}
29+
```
30+
31+
### Example
32+
33+
There is a working example in the `/src/examples/OperationsExample` directory of the repository.

docs/Usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void Configure(
117117
AppDbContext context)
118118
{
119119
context.Database.EnsureCreated();
120-
if(context.People.Any() == false)
120+
if(context.People.Count == 0)
121121
{
122122
context.People.Add(new Person {
123123
Name = "John Doe"

src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
<Import Project="..\..\..\build\dependencies.props" />
32
<PropertyGroup>
43
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
54
<PreserveCompilationContext>true</PreserveCompilationContext>

src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
<Import Project="..\..\..\build\dependencies.props" />
32
<PropertyGroup>
43
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
54
</PropertyGroup>

0 commit comments

Comments
 (0)