Model Class: DepartmentByName.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.Department table.
/// It uses the primary key to generate the Where clause for the Update operation.
/// The SqlParameter attribute defines an argument: nameArgument.
/// The SqlWhere attribute adds a Where clause using the nameArgument argument.
///
/// DepartmentID is the primary key.
/// </summary>
[SqlParameter("nameArgument", typeof(string))]
[Table("Department", Schema = "dbo")]
[UpdateWhereStrategy(UpdateWhereStrategy.KeyColumns)]
[SqlWhere("Name = :nameArgument")]
public class DepartmentByName
{
[Key]
public int DepartmentID { get; set; }
public string Name { get; set; }
public decimal Budget { get; set; }
public DateTime StartDate { get; set; }
public int? Administrator { get; set; }
}
}