-
Notifications
You must be signed in to change notification settings - Fork 94
/
Author.cs
34 lines (25 loc) · 1.06 KB
/
Author.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2021 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/
// Licensed under MIT license. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace DataLayer.EfClasses
{
//I have styled the Author entity class as a standard-styled entity,
//i.e. it can be created/updated via its property setters.
//Technically it has to have a public, parameterless constructor and all properties should have public setters
public class Author
{
public const int NameLength = 100;
public const int EmailLength = 100;
public Author() { }
public int AuthorId { get; set; }
[Required(AllowEmptyStrings = false)]
[MaxLength(NameLength)]
public string Name { get; set; }
[MaxLength(EmailLength)]
public string Email { get; set; }
//------------------------------
//Relationships
public ICollection<BookAuthor> BooksLink { get; set; }
}
}