Basic Annotations

[Table("Passport")]
public class Passport
{
	[Key]
	[DatabaseGenerated(DatabaseGenerationOption.Identity)]
	[Column(Order=1)]
	public int PassportNumber { get; set; }

	[Key]
	[Column(Order = 2)]
	[Column("IssuingCountry", TypeName="NVARCHAR")]
	public string IssuingCountry { get; set; }

	[Required]
	public DateTime Issued { get; set; }
	public DateTime Expires { get; set; }
}

public class PassportStamp
{
	[Key]
	[DatabaseGenerated(DatabaseGenerationOption.Computed)]
	public int StampId { get; set; }

	public DateTime Stamped { get; set; }

	[MaxLength(10), MinLength(5)]
	public string StampingCountry { get; set; }

	[ForeignKey("Passport")]
	[Column(Order = 1)]
	public int PassportNumber { get; set; }

	[ForeignKey("Passport")]
	[Column(Order = 2)]
	public string IssuingCountry { get; set; }

	public Passport Passport { get; set; }
	
	[InverseProperty("CreatedBy")]
  public List<Post> PostsWritten { get; set; }

	[NotMapped]
  public string Code => IssuingCountry.Substring(0, 1) + ":" + PassportNumber;
}

Complex Types

[ComplexType]
public class BlogDetails
{
	public DateTime? DateCreated { get; set; }

    [MaxLength(250)]
    public string Description { get; set; }
}

Concurrency Check

[ConcurrencyCheck, MaxLength(10, ErrorMessage="BloggerName must be 10 characters or less"), MinLength(5)]
public string BloggerName { get; set; }

Time Stamp

[Timestamp]
public Byte[] TimeStamp { get; set; }

Index Attribute