Book.cs
|
using System.ComponentModel.DataAnnotations; namespace BookStore3.Models { // Principal (parent) public class Book { [ Key ] [ Required ] public int Id { get; set; } [ Display( Name = "Book Title" ) ] [ Required ] public string Title { get; set; } [ DataType( DataType.Currency ) ] [ Range( 1, 100 ) ] public decimal Price { get; set; } [ Display( Name = "Publish Date" ) ] [ DataType( DataType.Date ) ] public DateTime PublishDate { get; set; } // Collection navigation containing dependents public ICollection<Author> Authors { get; } = new List<Author>( ); } } |
“I don’t have a girlfriend, but I know a girl who’d be real mad if she heard me say that. — Mitch Hedberg |