Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #683 from abpio/liangshiwei/docpatch
Browse files Browse the repository at this point in the history
Enhance Tutorials documents for nullable reference
  • Loading branch information
EngincanV authored Dec 29, 2023
2 parents 931ee53 + 19b4aed commit dae3093
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion en/tutorials/book-store/part-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public class CreateUpdateBookDto
{
[Required]
[StringLength(128)]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[Required]
public BookType Type { get; set; } = BookType.Undefined;
Expand Down
4 changes: 2 additions & 2 deletions en/tutorials/book-store/part-10.md
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ public class CreateModalModel : BookStorePageModel

[Required]
[StringLength(128)]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[Required]
public BookType Type { get; set; } = BookType.Undefined;
Expand Down Expand Up @@ -872,7 +872,7 @@ public class EditModalModel : BookStorePageModel

[Required]
[StringLength(128)]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[Required]
public BookType Type { get; set; } = BookType.Undefined;
Expand Down
16 changes: 8 additions & 8 deletions en/tutorials/book-store/part-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ public class Author : FullAuditedAggregateRoot<Guid>

internal Author(
Guid id,
[NotNull] string name,
string name,
DateTime birthDate,
[CanBeNull] string shortBio = null)
string? shortBio = null)
: base(id)
{
SetName(name);
BirthDate = birthDate;
ShortBio = shortBio;
}

internal Author ChangeName([NotNull] string name)
internal Author ChangeName(string name)
{
SetName(name);
return this;
}

private void SetName([NotNull] string name)
private void SetName(string name)
{
Name = Check.NotNullOrWhiteSpace(
name,
Expand Down Expand Up @@ -147,9 +147,9 @@ public class AuthorManager : DomainService
}

public async Task<Author> CreateAsync(
[NotNull] string name,
string name,
DateTime birthDate,
[CanBeNull] string shortBio = null)
string? shortBio = null)
{
Check.NotNullOrWhiteSpace(name, nameof(name));

Expand All @@ -168,8 +168,8 @@ public class AuthorManager : DomainService
}

public async Task ChangeNameAsync(
[NotNull] Author author,
[NotNull] string newName)
Author author,
string newName)
{
Check.NotNull(author, nameof(author));
Check.NotNullOrWhiteSpace(newName, nameof(newName));
Expand Down
6 changes: 3 additions & 3 deletions en/tutorials/book-store/part-8.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class CreateAuthorDto
{
[Required]
[StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[Required]
public DateTime BirthDate { get; set; }
Expand All @@ -148,12 +148,12 @@ public class UpdateAuthorDto
{
[Required]
[StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[Required]
public DateTime BirthDate { get; set; }

public string ShortBio { get; set; }
public string? ShortBio { get; set; }
}
````

Expand Down
8 changes: 4 additions & 4 deletions en/tutorials/book-store/part-9.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ namespace Acme.BookStore.Web.Pages.Authors
{
[Required]
[StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[Required]
[DataType(DataType.Date)]
public DateTime BirthDate { get; set; }

[TextArea]
public string ShortBio { get; set; }
public string? ShortBio { get; set; }
}
}
}
Expand Down Expand Up @@ -449,14 +449,14 @@ public class EditModalModel : BookStorePageModel

[Required]
[StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; }
public string Name { get; set; } = string.Empty;

[Required]
[DataType(DataType.Date)]
public DateTime BirthDate { get; set; }

[TextArea]
public string ShortBio { get; set; }
public string? ShortBio { get; set; }
}
}
```
Expand Down

0 comments on commit dae3093

Please sign in to comment.