Knight Data Access Layer
Maintenance Fields
Basic Tasks C# > Mapping > Maintenance Fields

Maintenance fields are specially named fields that are automatically filled in when inserting and deleting. 

 

Example:

    public class Vendor

    {

        //This is the primary key (See also the Primary Keys topic)

        public int VendorID { get; set; }

 

        //This is not a special field, it is simply a string property

        public string Name { get; set;  }

 

        //Optional. On insert, this property will be set to DateTime.Now

        public DateTime? CreateDate { get; set; }

 

        // Optional. On update, this property will be set to DateTime.Now

        public DateTime? UpdateDate { get; set; }

 

        // Optional. On insert, this property will be set to Environment.UserName

        public string CreateUser { get; set; }

 

        // Optional. On update, this property will be set to Environment.UserName

        public string UpdateUser { get; set; }

 

        // Optional. On update, this property will be set to Environment.MachineName

        public string MachineName{ get; set; }

   }