Model Class: Student.cs
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using SnapObjects.Data;
namespace Appeon.ApiDoc.Models.School
{
/// <summary>
/// This model class maps to the dbo.Person table.
/// It uses the primary key EnrollmentID to generate the Where clause for the Update operation.
/// The where condition is specified to only query the Student records.
///
/// PersonID is the primary key and the identity.
/// EnrollmentDate is required.
/// </summary>
[Table("Person", Schema = "dbo")]
[UpdateWhereStrategy(UpdateWhereStrategy.KeyColumns)]
[SqlWhere("Discriminator = 'Student'")]
public class Student
{
[Key]
[Identity]
public int PersonID { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
[Required]
public DateTime? EnrollmentDate { get; set; }
public string Discriminator { get; } = "Student";
}
}