Skip to content

Commit 2640675

Browse files
author
Bart Koelman
committed
Annotated example projects
1 parent d375b20 commit 2640675

Some content is hidden

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

46 files changed

+55
-133
lines changed

src/Examples/GettingStarted/Controllers/BooksController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using GettingStarted.Models;
42
using JsonApiDotNetCore.Configuration;
53
using JsonApiDotNetCore.Controllers;

src/Examples/GettingStarted/Controllers/PeopleController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using GettingStarted.Models;
42
using JsonApiDotNetCore.Configuration;
53
using JsonApiDotNetCore.Controllers;
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using GettingStarted.Models;
42
using JetBrains.Annotations;
53
using Microsoft.EntityFrameworkCore;
@@ -9,16 +7,11 @@ namespace GettingStarted.Data
97
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
108
public class SampleDbContext : DbContext
119
{
12-
public DbSet<Book> Books { get; set; }
10+
public DbSet<Book> Books => Set<Book>();
1311

1412
public SampleDbContext(DbContextOptions<SampleDbContext> options)
1513
: base(options)
1614
{
1715
}
18-
19-
protected override void OnModelCreating(ModelBuilder builder)
20-
{
21-
builder.Entity<Person>();
22-
}
2316
}
2417
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JetBrains.Annotations;
42
using JsonApiDotNetCore.Resources;
53
using JsonApiDotNetCore.Resources.Annotations;
@@ -10,12 +8,12 @@ namespace GettingStarted.Models
108
public sealed class Book : Identifiable<int>
119
{
1210
[Attr]
13-
public string Title { get; set; }
11+
public string Title { get; set; } = null!;
1412

1513
[Attr]
1614
public int PublishYear { get; set; }
1715

1816
[HasOne]
19-
public Person Author { get; set; }
17+
public Person Author { get; set; } = null!;
2018
}
2119
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using System.Collections.Generic;
42
using JetBrains.Annotations;
53
using JsonApiDotNetCore.Resources;
@@ -11,9 +9,9 @@ namespace GettingStarted.Models
119
public sealed class Person : Identifiable<int>
1210
{
1311
[Attr]
14-
public string Name { get; set; }
12+
public string Name { get; set; } = null!;
1513

1614
[HasMany]
17-
public ICollection<Book> Books { get; set; }
15+
public ICollection<Book> Books { get; set; } = new List<Book>();
1816
}
1917
}

src/Examples/GettingStarted/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using Microsoft.AspNetCore.Hosting;
42
using Microsoft.Extensions.Hosting;
53

src/Examples/GettingStarted/Startup.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using GettingStarted.Data;
42
using GettingStarted.Models;
53
using JetBrains.Annotations;

src/Examples/JsonApiDotNetCoreExample/Controllers/NonJsonApiController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using System.IO;
42
using System.Threading.Tasks;
53
using Microsoft.AspNetCore.Mvc;

src/Examples/JsonApiDotNetCoreExample/Controllers/OperationsController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JsonApiDotNetCore.AtomicOperations;
42
using JsonApiDotNetCore.Configuration;
53
using JsonApiDotNetCore.Controllers;

src/Examples/JsonApiDotNetCoreExample/Controllers/PeopleController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#nullable disable
2-
31
using JsonApiDotNetCore.Configuration;
42
using JsonApiDotNetCore.Controllers;
53
using JsonApiDotNetCore.Services;

0 commit comments

Comments
 (0)