Current Date Time Off Set Property

View Entity Current Date Time Off Set Property Configuration Options

Current Date and Time (Offset)

The AddCurrentDateTimeOffset method defines a backend-managed DateTimeOffset property that automatically stores the date and time when a specific action occurs (e.g., record creation or update).

This is especially useful for tracking when something happened, such as:

  • When a record was created (CreatedOn)
  • When a record was last updated (UpdatedOn)
  • When a status changed or was approved

You can define it like this:

designer.Properties.AddCurrentDateTimeOffset("CreatedOn", BkAutomaticUpdateOn.OnlyCreate);

In this example:

  • "CreatedOn" is the name of the property.
  • BkAutomaticUpdateOn.OnlyCreate tells the framework to assign the value only during record creation.

The framework will:

  • Automatically assign the current date and time (with time zone offset) based on the configuration.
  • Prevent any user from editing this property in the UI – no editor will be rendered in forms.
  • Allow the value to be shown in grid views, reports, or details pages as needed.

This property is completely managed by the system β€” you don’t need to worry about setting or updating it. Just define it and use it wherever you need to display time-related information.

publicpartialclassEmployee:IBkEntity<Employee,ApplicationDbContext>

{

    publicvoidBkConfiguration(IBkEntityDesigner<Employee,ApplicationDbContext>designer)

    {

        designer.Properties.AddCurrentDateTimeOffSet("CreatedOn",BkAutomaticUpdateOn.OnlyCreate);

// ... other properties    }

}

An unhandled error has occurred. Reload πŸ—™