-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathMysqlEntityMovie.cs
More file actions
64 lines (55 loc) · 1.92 KB
/
MysqlEntityMovie.cs
File metadata and controls
64 lines (55 loc) · 1.92 KB
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
62
63
64
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using CommunityToolkit.Datasync.Server.EntityFrameworkCore;
using CommunityToolkit.Datasync.TestCommon.Models;
using System.ComponentModel.DataAnnotations;
namespace CommunityToolkit.Datasync.TestCommon.Databases;
[ExcludeFromCodeCoverage]
public class MysqlEntityMovie : EntityTableData, IMovie, IEquatable<IMovie>
{
/// <summary>
/// True if the movie won the oscar for Best Picture
/// </summary>
public bool BestPictureWinner { get; set; }
/// <summary>
/// The running time of the movie
/// </summary>
[Required]
[Range(60, 360)]
public int Duration { get; set; }
/// <summary>
/// The MPAA rating for the movie, if available.
/// </summary>
public MovieRating Rating { get; set; } = MovieRating.Unrated;
/// <summary>
/// The release date of the movie.
/// </summary>
[Required]
public DateOnly ReleaseDate { get; set; }
/// <summary>
/// The title of the movie.
/// </summary>
[Required]
[StringLength(128, MinimumLength = 2)]
public string Title { get; set; } = string.Empty;
/// <summary>
/// The year that the movie was released.
/// </summary>
[Required]
[Range(1920, 2030)]
public int Year { get; set; }
/// <summary>
/// Determines if this movie has the same content as another movie.
/// </summary>
/// <param name="other">The other movie</param>
/// <returns>true if the content is the same</returns>
public bool Equals(IMovie other)
=> other != null
&& other.BestPictureWinner == BestPictureWinner
&& other.Duration == Duration
&& other.Rating == Rating
&& other.ReleaseDate == ReleaseDate
&& other.Title == Title
&& other.Year == Year;
}