Skip to content

master → develop #420

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

Merged
merged 104 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
5875c73
Merge pull request #1 from json-api-dotnet/master
milosloub Jun 29, 2018
f3272b0
Merge pull request #352 from json-api-dotnet/develop
jaredcnance Jul 25, 2018
2cbf4b8
doc(ContextGraph): add API documentation
jaredcnance Jul 26, 2018
d92752b
fix(#354): transform property name
jaredcnance Jul 26, 2018
f02f264
style(EntityResourceService)
jaredcnance Jul 26, 2018
48467f1
fix(EntityResourceService): pass relationship name to repository
jaredcnance Jul 26, 2018
5a7d7da
docs(IEntityReadRepository): add API documentation
jaredcnance Jul 26, 2018
46f1e2d
test(#354): add EntityResourceService tests
jaredcnance Jul 26, 2018
6d2ccf5
Merge pull request #355 from json-api-dotnet/fix/#354
jaredcnance Jul 26, 2018
66492a2
fix(GetOpProcessor): #340.1 not properly handling HasMany relationships
jaredcnance Jul 27, 2018
8e065ce
fix(OperationProcessorResolver): #340.2 wrong type throws null ref
jaredcnance Jul 27, 2018
ec5fa84
Merge pull request #357 from json-api-dotnet/fix/#340
jaredcnance Jul 27, 2018
13404ab
Update PULL_REQUEST_TEMPLATE.md
jaredcnance Jul 27, 2018
6c2214a
Merge pull request #2 from json-api-dotnet/master
milosloub Jul 31, 2018
b515283
Not IN filter
Jul 31, 2018
74667eb
Merge pull request #361 from milosloub/master
jaredcnance Jul 31, 2018
5f4a91d
doc(Identifiable): add xml docs
jaredcnance Aug 1, 2018
9c54535
Merge pull request #364 from json-api-dotnet/chore/docs
jaredcnance Aug 1, 2018
a050acd
feat: Error should accept objects for source
rtablada Aug 7, 2018
79fb285
feat: add 'GetPublicAttributeName' to ContextGraph
rtablada Aug 7, 2018
efa4aa7
Merge branch 'rt/get-context-property' into rt/validations-422
rtablada Aug 7, 2018
30c531d
wip: new 422 validation errors with source.pointer
rtablada Aug 7, 2018
0e17059
feat: validations send source.pointer
rtablada Aug 7, 2018
b841433
fix: handle 'GetPublicAttributeName' null and mock for tests
rtablada Aug 7, 2018
abbaed2
Merge pull request #370 from rtablada/rt/get-context-property
jaredcnance Aug 8, 2018
524232e
feat: throw 422 status code when validation fails
rtablada Aug 8, 2018
7e22eeb
feat: obsolete method ConvertToErrorCollection
rtablada Aug 8, 2018
f05b466
Merge pull request #371 from rtablada/rt/validations-422
jaredcnance Aug 8, 2018
262d341
chore(csproj): bump package version to 2.5.0
jaredcnance Aug 8, 2018
d7d16bd
fix(#343): reload relationships from database if included during POST
jaredcnance Aug 10, 2018
59bf942
don't reload individual relationships, just detach and then fetch
jaredcnance Aug 10, 2018
66ea1b3
cleanup
jaredcnance Aug 10, 2018
09f3846
introduce IEntityFrameworkRepository and bump version
jaredcnance Aug 10, 2018
c33c455
Merge pull request #373 from json-api-dotnet/fix/#343
jaredcnance Aug 11, 2018
eb2d9e9
fix(#362): improve error message for null HttpContext
jaredcnance Aug 11, 2018
ee7d069
fix(#313): Do not return 409 for generic InvalidCastException
jaredcnance Aug 11, 2018
8005d1a
Merge pull request #374 from json-api-dotnet/fix/#362
jaredcnance Aug 11, 2018
a9c7ff9
Merge pull request #375 from json-api-dotnet/fix/#313
jaredcnance Aug 11, 2018
71e52aa
first pass at auto-discovery
jaredcnance Aug 12, 2018
ea7f78f
fix tests
jaredcnance Jul 2, 2018
9832241
use IResourceNameFormatter in ContextGraph
jaredcnance Aug 12, 2018
cd2f92a
add documentation
jaredcnance Aug 12, 2018
4e3c46e
fix build
jaredcnance Aug 12, 2018
d5ee796
Merge pull request #376 from json-api-dotnet/feat/#241-2
jaredcnance Aug 12, 2018
0c27ed7
fix(#241): TypeLocator bug -- add tests
jaredcnance Aug 13, 2018
5ea9a17
Merge pull request #377 from json-api-dotnet/feat/#241-2
jaredcnance Aug 13, 2018
d1777cf
add acceptance test for deeply nested inclusions
jaredcnance Aug 14, 2018
3528e1f
first pass at deeply nested inclusion implementation
jaredcnance Aug 14, 2018
1b80f05
fix(JsonApiDeserializer): NullReferenceException
jaredcnance Aug 15, 2018
d930c5b
fix(DocumentBuilder): handle HasMany relationships
jaredcnance Aug 15, 2018
8847403
fix(JsonApiDeSerializer): allow empty collection
jaredcnance Aug 15, 2018
a2e6d06
chore(#368): add isues template and move files to .github
jaredcnance Aug 15, 2018
23329ab
Merge pull request #379 from json-api-dotnet/chore/#368
jaredcnance Aug 15, 2018
c457f6e
failing test + document how to get started
NullVoxPopuli Aug 28, 2018
a3d9e6c
fixed it
NullVoxPopuli Aug 28, 2018
b34bd3f
DateTime doesn't have an IS method.... so I don't know how we'll use …
NullVoxPopuli Aug 28, 2018
1506270
feat: error status code should be first in collection
rtablada Aug 28, 2018
84a78a0
apply pr feedback
NullVoxPopuli Aug 29, 2018
bea642d
work on adding tests for different scenarios
NullVoxPopuli Aug 29, 2018
4af95d1
assert included counts
NullVoxPopuli Aug 29, 2018
36c5eb6
these tests pass -- should probably add more specific tests though
NullVoxPopuli Aug 29, 2018
c7887b8
try to assert some more complicated stuff, and check specific include…
NullVoxPopuli Aug 29, 2018
46fcc98
Merge pull request #388 from rtablada/rt/better-error-codes
jaredcnance Aug 29, 2018
b02b3ec
I think I found a bug in the current implementation?
NullVoxPopuli Aug 29, 2018
41ba2ed
omg. im dumb
NullVoxPopuli Aug 29, 2018
bda10b8
hasMany.hasMany
NullVoxPopuli Aug 29, 2018
daa61ab
some more assertions
NullVoxPopuli Aug 29, 2018
1a367fa
this is a big one
NullVoxPopuli Aug 29, 2018
82cfa71
more assertions... and then commented out, because I don't know what …
NullVoxPopuli Aug 29, 2018
a3b3af4
update build config, bump package version and document process
jaredcnance Aug 30, 2018
df664ab
Merge pull request #392 from json-api-dotnet/chore/back-port-docs
jaredcnance Aug 30, 2018
e0b3cef
add additional assertions to test specific todoitem return
NullVoxPopuli Aug 30, 2018
a0b6080
this one is tricky
NullVoxPopuli Aug 30, 2018
909c4c6
it passes!
NullVoxPopuli Aug 30, 2018
edd0f22
fix test -- make assertions directly related to the feature under test
jaredcnance Sep 4, 2018
a8031c6
Merge pull request #389 from NullVoxPopuli/feature/#39-implementation
jaredcnance Sep 4, 2018
c1bf919
Merge pull request #387 from NullVoxPopuli/additional-filter-operations
jaredcnance Sep 4, 2018
54798b9
Merge pull request #390 from NullVoxPopuli/feature/#39-implementation…
jaredcnance Sep 4, 2018
b0e4fa1
Merge pull request #393 from NullVoxPopuli/feature/#39-implementation…
jaredcnance Sep 4, 2018
b073a0b
Merge pull request #378 from json-api-dotnet/feat/#39
jaredcnance Sep 4, 2018
5965fb3
fix(Identifiable): handle null id values
jaredcnance Sep 4, 2018
468b761
Merge pull request #395 from json-api-dotnet/fix/#382
jaredcnance Sep 4, 2018
9388683
fix(#347): parallel tests were stomping each other
jaredcnance Sep 4, 2018
113ab03
Merge pull request #396 from json-api-dotnet/fix/#347
jaredcnance Sep 4, 2018
e93e12e
fix(#394): register shorthand service types during discovery
jaredcnance Sep 8, 2018
b6ce80d
Merge pull request #399 from json-api-dotnet/fix/#394
jaredcnance Sep 8, 2018
1a9fd65
Remove `DocumentData`, instead use `ResourceObject`
btecu Sep 11, 2018
491a6cb
Merge pull request #403 from btecu/services
jaredcnance Sep 11, 2018
d0a2c42
fixing auto-discovery
jaredcnance Sep 23, 2018
550dcdd
add getting started project
jaredcnance Sep 23, 2018
b0ab4dd
optional attribute and relationship names
jaredcnance Sep 23, 2018
f740f25
build getting started in build.ps1
jaredcnance Sep 23, 2018
66470a9
fix build script
jaredcnance Sep 23, 2018
529a562
add DiscoveryTests
jaredcnance Sep 23, 2018
453d4fc
fix tests
jaredcnance Sep 23, 2018
02f98c7
add ContextGraphBuilder tests
jaredcnance Sep 23, 2018
be0d510
add tests
jaredcnance Sep 24, 2018
f8867e4
feat(402): adds filter and sort to ResourceDefinition
jaredcnance Sep 24, 2018
38c39a0
fix tests
jaredcnance Sep 26, 2018
61372ff
implement new resource definition featurees
jaredcnance Sep 26, 2018
a2053be
run ResourceEntitySeparationExampleTests on CI
jaredcnance Oct 1, 2018
adddc1f
Merge pull request #417 from json-api-dotnet/fix/ci-tests-not-running
jaredcnance Oct 2, 2018
e3a3345
Merge branch 'master' into feat/#293
jaredcnance Oct 2, 2018
84f45a9
Merge pull request #409 from json-api-dotnet/feat/#293
jaredcnance Oct 3, 2018
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
41 changes: 41 additions & 0 deletions .github/CONTRIBUTING.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing

## Workflow

1. Search through the issues to see if your particular issue has already been discovered and possibly addressed
2. Open an issue if you can't find anything helpful
3. Open a PR for proposed changes

## Commit Guidelines

I have chosen to loosely follow the [Angular Commit Guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit)

# Documentation

If you'd like to help us improve our documentation, please checkout our [GitHub pages repository](https://github.com/json-api-dotnet/json-api-dotnet.github.io) where we host our documentation.

# Backporting Features To Prior Releases

To backport a feature that has been approved and merged into `master`:

## Requester

Open an issue requesting the feature you would like backported. The change will be reviewed based on:

- compatibility
- difficulty in porting the change
- the added value the feature provides for users on the older versions
- how difficult it is for users to migrate from the older version to the newer version

## Maintainer

- Checkout the version you want to apply the feature on top of and create a new branch to release the new version:
```
git checkout tags/v2.5.1 -b release/2.5.2
```
- Cherrypick the merge commit: `git cherry-pick {git commit SHA}`
- Bump the package version in the csproj
- Make any other compatibility, documentation or tooling related changes
- Push the branch to origin and verify the build
- Once the build is verified, create a GitHub release, tagging the release branch
- Open a PR back to master with any other additions
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Description

...

## Environment

- JsonApiDotNetCore Version:
- Other Relevant Package Versions:
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


Closes #{ISSUE_NUMBER}

#### BUG FIX
- [ ] reproduce issue in tests
- [ ] fix issue
- [ ] bump package version

#### FEATURE
- [ ] write tests that address the requirements outlined in the issue
- [ ] fulfill the feature requirements
- [ ] bump package version

#### RELATED REPOSITORY UPDATES
- does this feature require documentation? if so, open an issue in the [docs repo](https://github.com/json-api-dotnet/json-api-dotnet.github.io/issues/new)
- does this feature break an API that is implemented in the templates repository? if so, [open an issue](https://github.com/json-api-dotnet/Templates/issues/new)
11 changes: 10 additions & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ $revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)

dotnet restore

dotnet build ./src/Examples/GettingStarted/GettingStarted.csproj
CheckLastExitCode

dotnet test ./test/UnitTests/UnitTests.csproj
CheckLastExitCode

Expand All @@ -35,7 +38,13 @@ CheckLastExitCode
dotnet test ./test/OperationsExampleTests/OperationsExampleTests.csproj
CheckLastExitCode

dotnet build .\src\JsonApiDotNetCore -c Release
dotnet test ./test/ResourceEntitySeparationExampleTests/ResourceEntitySeparationExampleTests.csproj
CheckLastExitCode

dotnet test ./test/DiscoveryTests/DiscoveryTests.csproj
CheckLastExitCode

dotnet build ./src/JsonApiDotNetCore/JsonApiDotNetCore.csproj -c Release
CheckLastExitCode

Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG"
Expand Down
15 changes: 0 additions & 15 deletions CONTRIBUTING.MD

This file was deleted.

32 changes: 31 additions & 1 deletion JsonApiDotnetCore.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Expand Down Expand Up @@ -45,6 +45,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEntitySeparationExa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEntitySeparationExampleTests", "test\ResourceEntitySeparationExampleTests\ResourceEntitySeparationExampleTests.csproj", "{6DFA30D7-1679-4333-9779-6FB678E48EF5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GettingStarted", "src\Examples\GettingStarted\GettingStarted.csproj", "{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscoveryTests", "test\DiscoveryTests\DiscoveryTests.csproj", "{09C0C8D8-B721-4955-8889-55CB149C3B5C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -187,6 +191,30 @@ Global
{6DFA30D7-1679-4333-9779-6FB678E48EF5}.Release|x64.Build.0 = Release|Any CPU
{6DFA30D7-1679-4333-9779-6FB678E48EF5}.Release|x86.ActiveCfg = Release|Any CPU
{6DFA30D7-1679-4333-9779-6FB678E48EF5}.Release|x86.Build.0 = Release|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x64.ActiveCfg = Debug|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x64.Build.0 = Debug|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x86.ActiveCfg = Debug|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Debug|x86.Build.0 = Debug|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|Any CPU.Build.0 = Release|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x64.ActiveCfg = Release|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x64.Build.0 = Release|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x86.ActiveCfg = Release|Any CPU
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71}.Release|x86.Build.0 = Release|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x64.ActiveCfg = Debug|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x64.Build.0 = Debug|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x86.ActiveCfg = Debug|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Debug|x86.Build.0 = Debug|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|Any CPU.Build.0 = Release|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x64.ActiveCfg = Release|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x64.Build.0 = Release|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x86.ActiveCfg = Release|Any CPU
{09C0C8D8-B721-4955-8889-55CB149C3B5C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -205,6 +233,8 @@ Global
{9CD2C116-D133-4FE4-97DA-A9FEAFF045F1} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
{F4097194-9415-418A-AB4E-315C5D5466AF} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
{6DFA30D7-1679-4333-9779-6FB678E48EF5} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
{9B2A5AD7-0BF4-472E-A1B4-8BB623FDEB71} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
{09C0C8D8-B721-4955-8889-55CB149C3B5C} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2421882-8F0A-4905-928F-B550B192F9A4}
Expand Down
11 changes: 0 additions & 11 deletions PULL_REQUEST_TEMPLATE.md

This file was deleted.

36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,39 @@ public class Startup
}
}
```

### Development

Restore all nuget packages with:

```bash
dotnet restore
```

#### Testing

Running tests locally requires access to a postgresql database.
If you have docker installed, this can be propped up via:

```bash
docker run --rm --name jsonapi-dotnet-core-testing \
-e POSTGRES_DB=JsonApiDotNetCoreExample \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgres
```

And then to run the tests:

```bash
dotnet test
```

#### Cleaning

Sometimes the compiled files can be dirty / corrupt from other branches / failed builds.

```bash
dotnet clean
```
13 changes: 13 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ branches:
- master
- develop
- unstable
- /release\/.+/

nuget:
disable_publish_on_pr: true
Expand All @@ -38,6 +39,7 @@ test: off
artifacts:
- path: .\**\artifacts\**\*.nupkg
name: NuGet

deploy:
- provider: NuGet
server: https://www.myget.org/F/research-institute/api/v2/package
Expand All @@ -47,17 +49,28 @@ deploy:
symbol_server: https://www.myget.org/F/research-institute/symbols/api/v2/package
on:
branch: develop

- provider: NuGet
server: https://www.myget.org/F/jadnc/api/v2/package
api_key:
secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3
skip_symbols: false
on:
branch: unstable

- provider: NuGet
name: production
skip_symbols: false
api_key:
secure: /fsEOgG4EdtNd6DPmko9h3NxQwx1IGDcFreGTKd2KA56U2KEkpX/L/pCGpCIEf2s
on:
branch: master
appveyor_repo_tag: true

- provider: NuGet
skip_symbols: false
api_key:
secure: /fsEOgG4EdtNd6DPmko9h3NxQwx1IGDcFreGTKd2KA56U2KEkpX/L/pCGpCIEf2s
on:
branch: /release\/.+/
appveyor_repo_tag: true
2 changes: 1 addition & 1 deletion benchmarks/Serialization/JsonApiDeserializer_Benchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Benchmarks.Serialization {
public class JsonApiDeserializer_Benchmarks {
private const string TYPE_NAME = "simple-types";
private static readonly string Content = JsonConvert.SerializeObject(new Document {
Data = new DocumentData {
Data = new ResourceObject {
Type = TYPE_NAME,
Id = "1",
Attributes = new Dictionary<string, object> {
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dotnet test ./test/UnitTests/UnitTests.csproj
dotnet test ./test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj
dotnet test ./test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
dotnet test ./test/OperationsExampleTests/OperationsExampleTests.csproj
dotnet test ./test/ResourceEntitySeparationExampleTests/ResourceEntitySeparationExampleTests.csproj
1 change: 1 addition & 0 deletions src/Examples/GettingStarted/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.db
15 changes: 15 additions & 0 deletions src/Examples/GettingStarted/Controllers/ArticlesController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using GettingStarted.Models;
using JsonApiDotNetCore.Controllers;
using JsonApiDotNetCore.Services;

namespace GettingStarted
{
public class ArticlesController : JsonApiController<Article>
{
public ArticlesController(
IJsonApiContext jsonApiContext,
IResourceService<Article> resourceService)
: base(jsonApiContext, resourceService)
{ }
}
}
15 changes: 15 additions & 0 deletions src/Examples/GettingStarted/Controllers/PeopleController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using GettingStarted.Models;
using JsonApiDotNetCore.Controllers;
using JsonApiDotNetCore.Services;

namespace GettingStarted
{
public class PeopleController : JsonApiController<Person>
{
public PeopleController(
IJsonApiContext jsonApiContext,
IResourceService<Person> resourceService)
: base(jsonApiContext, resourceService)
{ }
}
}
17 changes: 17 additions & 0 deletions src/Examples/GettingStarted/Data/SampleDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using GettingStarted.Models;
using GettingStarted.ResourceDefinitionExample;
using Microsoft.EntityFrameworkCore;

namespace GettingStarted
{
public class SampleDbContext : DbContext
{
public SampleDbContext(DbContextOptions<SampleDbContext> options)
: base(options)
{ }

public DbSet<Article> Articles { get; set; }
public DbSet<Person> People { get; set; }
public DbSet<Model> Models { get; set; }
}
}
21 changes: 21 additions & 0 deletions src/Examples/GettingStarted/GettingStarted.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../JsonApiDotNetCore/JsonApiDotNetCore.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions src/Examples/GettingStarted/Models/Article.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using JsonApiDotNetCore.Models;

namespace GettingStarted.Models
{
public class Article : Identifiable
{
[Attr]
public string Title { get; set; }

[HasOne]
public Person Author { get; set; }
public int AuthorId { get; set; }
}
}
14 changes: 14 additions & 0 deletions src/Examples/GettingStarted/Models/Person.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using JsonApiDotNetCore.Models;

namespace GettingStarted.Models
{
public class Person : Identifiable
{
[Attr]
public string Name { get; set; }

[HasMany]
public List<Article> Articles { get; set; }
}
}
Loading