Show / Hide Table of Contents

    Model Class: DepartmentInfo.cs

    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using SnapObjects.Data;
    using Newtonsoft.Json;
    
    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. 
        /// 
        /// DepartmentID is the primary key. 
        /// The Courses property is applied with the ModelEmbedded attribute. 
        /// The ModelEmbedded attribute defines the one-to-more relationship between the department and the courses.
        /// </summary>
        [Table("Department", Schema = "dbo")]
        [UpdateWhereStrategy(UpdateWhereStrategy.KeyColumns)]
        public class DepartmentInfo
        {
            [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; }
    
            [JsonIgnore]
            [SetValue("$DepartmentID", "$DepartmentID", SetValueStrategy.Always)]
            [ModelEmbedded(typeof(CourseInfo), ParamValue = "$DepartmentID", 
                CascadeCreate = true, CascadeDelete = true)]
            public IList<CourseInfo> Courses { get; set; }
        }
    }
    
    Back to top Generated by Appeon