Skip to content

Instantly share code, notes, and snippets.

@nanotaboada
Last active November 11, 2023 19:46
Show Gist options
  • Save nanotaboada/4054009 to your computer and use it in GitHub Desktop.
Save nanotaboada/4054009 to your computer and use it in GitHub Desktop.
A Plain Old CLR Object (POCO) model of a Book with DataAnnotations for validation
using System;
using System.ComponentModel.DataAnnotations;
namespace NanoTaboada.GitHub.Gist
{
public class Book
{
[Key]
public string Isbn { get; set; }
[Required]
public string Title { get; set; }
public string SubTitle { get; set; }
[Required]
public string Author { get; set; }
public string Publisher { get; set; }
[Required]
public DateTime Published { get; set; }
public int Pages { get; set; }
[Required]
public string Description { get; set; }
[Required]
[Url]
public string Website { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment