Skip to content

Commit b8ccc2a

Browse files
committed
nullability tests
1 parent b3660c7 commit b8ccc2a

19 files changed

+86
-103
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.ComponentModel.DataAnnotations;
32
using System.ComponentModel.DataAnnotations.Schema;
43

@@ -13,20 +12,20 @@ public class Audit
1312
public DateTime Date { get; set; }
1413
public int? UserId { get; set; }
1514
public int? TaskId { get; set; }
16-
public string Content { get; set; }
17-
public string Username { get; set; }
15+
public string? Content { get; set; }
16+
public string? Username { get; set; }
1817
public DateTimeOffset Created { get; set; }
19-
public string CreatedBy { get; set; }
18+
public string? CreatedBy { get; set; }
2019
public DateTimeOffset Updated { get; set; }
21-
public string UpdatedBy { get; set; }
20+
public string? UpdatedBy { get; set; }
2221

2322
[ConcurrencyCheck]
2423
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
2524
[DataFieldConverter(typeof(ConcurrencyTokenHandler))]
2625
public ConcurrencyToken RowVersion { get; set; }
2726

2827
[NotMapped]
29-
public virtual Task Task { get; set; }
28+
public virtual Task? Task { get; set; }
3029
[NotMapped]
31-
public virtual User User { get; set; }
30+
public virtual User? User { get; set; }
3231
}

test/FluentCommand.Entities/Brand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ namespace FluentCommand.Entities;
33
public class Brand
44
{
55
public int Id { get; set; }
6-
public string Name { get; set; }
7-
public string Description { get; set; }
6+
public string? Name { get; set; }
7+
public string? Description { get; set; }
88
}

test/FluentCommand.Entities/DataType.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.ComponentModel.DataAnnotations;
32
using System.ComponentModel.DataAnnotations.Schema;
43

@@ -10,7 +9,7 @@ public class DataType
109
[Key]
1110
public long Id { get; set; }
1211

13-
public string Name { get; set; }
12+
public string? Name { get; set; }
1413

1514
public bool Boolean { get; set; }
1615

test/FluentCommand.Entities/FluentCommand.Entities.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0;net8.0;net9.0;net10.0</TargetFrameworks>
4+
<ImplicitUsings>enable</ImplicitUsings>
5+
<Nullable>enable</Nullable>
46
<IsPackable>false</IsPackable>
57
<LangVersion>latest</LangVersion>
68
</PropertyGroup>

test/FluentCommand.Entities/Member.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ public class Member
99
public Guid Id { get; set; }
1010

1111
[Column("email_address")]
12-
public string EmailAddress { get; set; }
12+
public string? EmailAddress { get; set; }
1313

1414
[Column("display_name")]
15-
public string DisplayName { get; set; }
15+
public string? DisplayName { get; set; }
1616

1717
[Column("first_name")]
18-
public string FirstName { get; set; }
18+
public string? FirstName { get; set; }
1919

2020
[Column("last_name")]
21-
public string LastName { get; set; }
21+
public string? LastName { get; set; }
2222
}

test/FluentCommand.Entities/Priority.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.ComponentModel.DataAnnotations;
42
using System.ComponentModel.DataAnnotations.Schema;
53

@@ -11,14 +9,14 @@ namespace FluentCommand.Entities;
119
public class Priority
1210
{
1311
public int Id { get; set; }
14-
public string Name { get; set; }
15-
public string Description { get; set; }
12+
public string? Name { get; set; }
13+
public string? Description { get; set; }
1614
public int DisplayOrder { get; set; }
1715
public bool IsActive { get; set; }
1816
public DateTimeOffset Created { get; set; }
19-
public string CreatedBy { get; set; }
17+
public string? CreatedBy { get; set; }
2018
public DateTimeOffset Updated { get; set; }
21-
public string UpdatedBy { get; set; }
19+
public string? UpdatedBy { get; set; }
2220

2321
[ConcurrencyCheck]
2422
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
namespace FluentCommand.Entities;
1+
namespace FluentCommand.Entities;
22

33
public class Product
44
{
55
public int Id { get; set; }
6-
public string Name { get; set; }
7-
public string Description { get; set; }
6+
public string? Name { get; set; }
7+
public string? Description { get; set; }
88
}

test/FluentCommand.Entities/Role.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.ComponentModel.DataAnnotations;
42
using System.ComponentModel.DataAnnotations.Schema;
53

@@ -11,12 +9,12 @@ namespace FluentCommand.Entities;
119
public class Role
1210
{
1311
public Guid Id { get; set; }
14-
public string Name { get; set; }
15-
public string Description { get; set; }
12+
public string Name { get; set; } = null!;
13+
public string? Description { get; set; }
1614
public DateTimeOffset Created { get; set; }
17-
public string CreatedBy { get; set; }
15+
public string? CreatedBy { get; set; }
1816
public DateTimeOffset Updated { get; set; }
19-
public string UpdatedBy { get; set; }
17+
public string? UpdatedBy { get; set; }
2018

2119
[ConcurrencyCheck]
2220
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]

test/FluentCommand.Entities/Status.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.ComponentModel.DataAnnotations;
42
using System.ComponentModel.DataAnnotations.Schema;
53

@@ -11,14 +9,14 @@ namespace FluentCommand.Entities;
119
public class Status
1210
{
1311
public int Id { get; set; }
14-
public string Name { get; set; }
15-
public string Description { get; set; }
12+
public string Name { get; set; } = null!;
13+
public string? Description { get; set; }
1614
public int DisplayOrder { get; set; }
1715
public bool IsActive { get; set; }
1816
public DateTimeOffset Created { get; set; }
19-
public string CreatedBy { get; set; }
17+
public string? CreatedBy { get; set; }
2018
public DateTimeOffset Updated { get; set; }
21-
public string UpdatedBy { get; set; }
19+
public string? UpdatedBy { get; set; }
2220

2321
[ConcurrencyCheck]
2422
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]

test/FluentCommand.Entities/StatusConstructor.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.ComponentModel.DataAnnotations;
32
using System.ComponentModel.DataAnnotations.Schema;
43

@@ -12,13 +11,13 @@ public class StatusConstructor
1211
public StatusConstructor(
1312
int id,
1413
string name,
15-
string description,
14+
string? description,
1615
bool isActive,
1716
int displayOrder,
1817
DateTimeOffset created,
19-
string createdBy,
18+
string? createdBy,
2019
DateTimeOffset updated,
21-
string updatedBy,
20+
string? updatedBy,
2221
ConcurrencyToken rowVersion)
2322
{
2423
Id = id;
@@ -35,13 +34,13 @@ public StatusConstructor(
3534

3635
public int Id { get; }
3736
public string Name { get; }
38-
public string Description { get; }
37+
public string? Description { get; }
3938
public int DisplayOrder { get; }
4039
public bool IsActive { get; }
4140
public DateTimeOffset Created { get; }
42-
public string CreatedBy { get; }
41+
public string? CreatedBy { get; }
4342
public DateTimeOffset Updated { get; }
44-
public string UpdatedBy { get; }
43+
public string? UpdatedBy { get; }
4544

4645
[ConcurrencyCheck]
4746
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]

0 commit comments

Comments
 (0)