Browse Source

Merge pull request #18585 from abpframework/liangshiwei/docs

Enhance Totorials document for nullable reference
pull/18586/head
Engincan VESKE 2 years ago
committed by GitHub
parent
commit
f0f7ed32a3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docs/en/Tutorials/Part-1.md
  2. 4
      docs/en/Tutorials/Part-10.md
  3. 16
      docs/en/Tutorials/Part-6.md
  4. 8
      docs/en/Tutorials/Part-8.md
  5. 8
      docs/en/Tutorials/Part-9.md

2
docs/en/Tutorials/Part-1.md

@ -368,7 +368,7 @@ public class CreateUpdateBookDto
{ {
[Required] [Required]
[StringLength(128)] [StringLength(128)]
public string Name { get; set; } public string Name { get; set; } = string.Empty;
[Required] [Required]
public BookType Type { get; set; } = BookType.Undefined; public BookType Type { get; set; } = BookType.Undefined;

4
docs/en/Tutorials/Part-10.md

@ -788,7 +788,7 @@ public class CreateModalModel : BookStorePageModel
[Required] [Required]
[StringLength(128)] [StringLength(128)]
public string Name { get; set; } public string Name { get; set; } = string.Empty;
[Required] [Required]
public BookType Type { get; set; } = BookType.Undefined; public BookType Type { get; set; } = BookType.Undefined;
@ -871,7 +871,7 @@ public class EditModalModel : BookStorePageModel
[Required] [Required]
[StringLength(128)] [StringLength(128)]
public string Name { get; set; } public string Name { get; set; } = string.Empty;
[Required] [Required]
public BookType Type { get; set; } = BookType.Undefined; public BookType Type { get; set; } = BookType.Undefined;

16
docs/en/Tutorials/Part-6.md

@ -75,9 +75,9 @@ public class Author : FullAuditedAggregateRoot<Guid>
internal Author( internal Author(
Guid id, Guid id,
[NotNull] string name, string name,
DateTime birthDate, DateTime birthDate,
[CanBeNull] string shortBio = null) string? shortBio = null)
: base(id) : base(id)
{ {
SetName(name); SetName(name);
@ -85,13 +85,13 @@ public class Author : FullAuditedAggregateRoot<Guid>
ShortBio = shortBio; ShortBio = shortBio;
} }
internal Author ChangeName([NotNull] string name) internal Author ChangeName(string name)
{ {
SetName(name); SetName(name);
return this; return this;
} }
private void SetName([NotNull] string name) private void SetName(string name)
{ {
Name = Check.NotNullOrWhiteSpace( Name = Check.NotNullOrWhiteSpace(
name, name,
@ -146,9 +146,9 @@ public class AuthorManager : DomainService
} }
public async Task<Author> CreateAsync( public async Task<Author> CreateAsync(
[NotNull] string name, string name,
DateTime birthDate, DateTime birthDate,
[CanBeNull] string shortBio = null) string? shortBio = null)
{ {
Check.NotNullOrWhiteSpace(name, nameof(name)); Check.NotNullOrWhiteSpace(name, nameof(name));
@ -167,8 +167,8 @@ public class AuthorManager : DomainService
} }
public async Task ChangeNameAsync( public async Task ChangeNameAsync(
[NotNull] Author author, Author author,
[NotNull] string newName) string newName)
{ {
Check.NotNull(author, nameof(author)); Check.NotNull(author, nameof(author));
Check.NotNullOrWhiteSpace(newName, nameof(newName)); Check.NotNullOrWhiteSpace(newName, nameof(newName));

8
docs/en/Tutorials/Part-8.md

@ -123,12 +123,12 @@ public class CreateAuthorDto
{ {
[Required] [Required]
[StringLength(AuthorConsts.MaxNameLength)] [StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; } public string Name { get; set; } = string.Empty;
[Required] [Required]
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
public string ShortBio { get; set; } public string? ShortBio { get; set; }
} }
```` ````
@ -146,12 +146,12 @@ public class UpdateAuthorDto
{ {
[Required] [Required]
[StringLength(AuthorConsts.MaxNameLength)] [StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; } public string Name { get; set; } = string.Empty;
[Required] [Required]
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
public string ShortBio { get; set; } public string? ShortBio { get; set; }
} }
```` ````

8
docs/en/Tutorials/Part-9.md

@ -331,14 +331,14 @@ public class CreateModalModel : BookStorePageModel
{ {
[Required] [Required]
[StringLength(AuthorConsts.MaxNameLength)] [StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; } public string Name { get; set; } = string.Empty;
[Required] [Required]
[DataType(DataType.Date)] [DataType(DataType.Date)]
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
[TextArea] [TextArea]
public string ShortBio { get; set; } public string? ShortBio { get; set; }
} }
} }
``` ```
@ -454,14 +454,14 @@ public class EditModalModel : BookStorePageModel
[Required] [Required]
[StringLength(AuthorConsts.MaxNameLength)] [StringLength(AuthorConsts.MaxNameLength)]
public string Name { get; set; } public string Name { get; set; } = string.Empty;
[Required] [Required]
[DataType(DataType.Date)] [DataType(DataType.Date)]
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
[TextArea] [TextArea]
public string ShortBio { get; set; } public string? ShortBio { get; set; }
} }
} }
``` ```

Loading…
Cancel
Save