Show / Hide Table of Contents

    Model Class: CourseAndOnlineInfo.cs

    using System;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using SnapObjects.Data;
    using Newtonsoft.Json;
    using System.Collections.Generic;
    
    namespace Appeon.ApiDoc.Models.School
    {
        /// <summary>
        /// This model class maps to the dbo.Course table. 
        /// It uses the primary key to generate the Where clause for the Update operation.
        /// 
        /// CourseID is the primary key.
        /// 
        /// The OnlineCourses property is applied with the ModelEmbedded attribute.
        /// The ModelEmbedded attribute defines the one-to-one relationship between the Course and 
        /// the OnlineCourse record.
        /// </summary>
        [Table("Course", Schema = "dbo")]
        [UpdateWhereStrategy(UpdateWhereStrategy.KeyColumns)]
        public class CourseAndOnlineInfo
        {
            [Key]
            public int CourseID { get; set; }
    
            public string Title { get; set; }
    
            public int Credits { get; set; }
    
            public int DepartmentID { get; set; }
    
            [JsonIgnore]
            [SetValue("$CourseID", "$CourseID", SetValueStrategy.Always)]
            [ModelEmbedded(typeof(OnlineCourse), ParamValue = "$CourseID", 
                CascadeCreate = true, CascadeDelete = true)]
            public OnlineCourse OnlineCourse { get; set; }
        }
    }
    
    Back to top Generated by Appeon