■ ColumnAttribute 클래스의 TypeName 속성을 사용하는 방법을 보여준다.
▶ Movie.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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace TestProject.Models { /// <summary> /// 영화 /// </summary> public class Movie { //////////////////////////////////////////////////////////////////////////////////////////////////// Property ////////////////////////////////////////////////////////////////////////////////////////// Public #region ID - ID /// <summary> /// ID /// </summary> public int ID { get; set; } #endregion #region 제목 - Title /// <summary> /// 제목 /// </summary> public string Title { get; set; } #endregion #region 릴리즈 일자 - ReleaseDate /// <summary> /// 릴리즈 일자 /// </summary> [DataType(DataType.Date)] [Display(Name = "Release Date")] public DateTime ReleaseDate { get; set; } #endregion #region 장르 - Genre /// <summary> /// 장르 /// </summary> public string Genre { get; set; } #endregion #region 가격 - Price /// <summary> /// 가격 /// </summary> [Column(TypeName = "decimal(18, 2)")] public decimal Price { get; set; } #endregion } } |