Knight Data Access Layer
FillInMaintenanceFields Property (DataHelper)
Example 




KellermanSoftware.NetDataAccessLayer Namespace > DataHelper Class : FillInMaintenanceFields Property
If true, properties such as CreateDate, UpdateDate, CreateUser will be automatically filled in before saving The default is true
Syntax
Public Overridable Property FillInMaintenanceFields As Boolean
Dim instance As DataHelper
Dim value As Boolean
 
instance.FillInMaintenanceFields = value
 
value = instance.FillInMaintenanceFields
public virtual bool FillInMaintenanceFields {get; set;}
public: __property virtual bool get_FillInMaintenanceFields();
public: __property virtual void set_FillInMaintenanceFields( 
   bool value
);
public:
virtual property bool FillInMaintenanceFields {
   bool get();
   void set (    bool value);
}
Remarks
See also MaintFields
Example
//Get the current thread static safe instance of the helper
IDataHelper db = DataHelper.SessionFactory();
 
//Specify User Name and License Key from the receipt, leave blank for trial mode
//db.UserName = "John Smith 1234";
//db.LicenseKey = "asdfl219==";
 
//Enable Filling in Maint Fields (the default)
db.FillInMaintenanceFields = true;
 
//Log to the console
db.EnableLogging();
 
//Open the database connection
db.OpenConnection();
 
//Create a new Person to save to the database
Person currentPerson = new Person();
currentPerson.FirstName = "John";
currentPerson.LastName = "Smith";            
 
//Save it to the database 
db.Save(currentPerson);
 
//Create date will be automatically filled in because it is auto detected as a maintenance field by the name
//To see the full list of Maint fields do a get on DataHelper.MaintenanceFields
Console.WriteLine(currentPerson.DateCreated);
 
//Close the connection
db.CloseConnection();
'Get the current thread static safe instance of the helper
Dim db As IDataHelper = DataHelper.SessionFactory()
 
'Specify User Name and License Key from the receipt, leave blank for trial mode
'db.UserName = "John Smith 1234"
'db.LicenseKey = "asdfl219=="
 
'Enable Filling in Maint Fields (the default)
db.FillInMaintenanceFields = True
 
'Log to the console
db.EnableLogging()
 
'Open the database connection
db.OpenConnection()
 
'Create a new Person to save to the database
Dim currentPerson As New Person()
currentPerson.FirstName = "John"
currentPerson.LastName = "Smith"
 
'Save it to the database 
db.Save(currentPerson)
 
'Create date will be automatically filled in because it is auto detected as a maintenance field by the name
'To see the full list of Maint fields do a get on DataHelper.MaintenanceFields
Console.WriteLine(currentPerson.DateCreated)
 
'Close the connection
db.CloseConnection()
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DataHelper Class
DataHelper Members