MODEL_SUFFIX

<< >>

Navigation:  CodeStencil > Custom Library > Code Nanites > Table Related > GenerateModel >

MODEL_SUFFIX

The MODEL_SUFFIX is an expander that is used by the GenerateModel code nanite to modify the definition of the model class. As the name suggests, it add a suffix.

For example, if you want your model to inherit from another class you can specify it in that expander. To show how this works:

 

If you don't already have the MODEL_SUFFIX created, then you need to add as an Expander (See Expanders)

Next specify the suffix, in this case we want to inherit from the AuditableBaseEntry class, so we add the expansion string: " : AuditableBaseEntry"

 

 

CS_clip0117

 

The generated code will look like this:

using System;

using System.Collections.Generic;

 

namespace MyProject.Models

{

  public partial class Course  : AuditableBaseEntity

   {

      public Course()

       {

           CourseAssignments = new HashSet<CourseAssignment>();

           Enrollments = new HashSet<Enrollment>();

       }

       

      public int CourseID { get; set; }

      public int Credits { get; set; }

      public string Title { get; set; }

      public int DepartmentID { get; set; }

       

      public virtual Department Department { get; set; }

      public virtual ICollection<CourseAssignment> CourseAssignments { get; set; }

      public virtual ICollection<Enrollment> Enrollments { get; set; }

 

   }

}