📘
TimeLine E3
  • TimeLine E3 Documentation
  • Framework
    • Introduction
    • DataSet Definition
    • Window Handling Object
      • Input/Output arguments
      • Open
      • BindDataControls
      • Item Changes
      • Item Search
      • MenuItemClicked
      • Print
      • ModuleOpened (BlueArrow)
      • BlueArrowArguments
      • New Row
      • Delete Row
      • Save
      • Transactions
      • Locking [deprecated]
      • Locking (new)
      • Resizing a response window
      • ParaPanel
      • Adding DMS Tab to a Module
    • BusinessObject
    • Controls
      • BindingFormat
      • LookupGrid and SearchDef
      • ComboBox
      • RadioButton
      • Multiline Textbox
      • xTextBoxSearch
      • xFileBrowse [v16+]
      • DxDispoColumn
      • DxProgressColumn
      • DxTemplateColumn
      • Change control caption programmatically
      • TabControl
      • Navigation
      • Enable controls programmatically
      • Enable a MenuItem programmatically
      • Filter search values
      • Jumping to another module
      • Messages, Notifications, Log, Exceptions, Translation
      • LoggerSink [deprecated]
      • Log
      • OpenFile, FolderBrowsing and SaveFile
      • Execute Actions while displaying an Hourglass
      • Using Progress
      • Async methods with progress bar
      • Wizard
      • Customizing controls using xBehaviors
      • TLProperty.AllowInReadOnly [v16+]
    • DataSet Operations
    • Business-related functionality
      • Getting the next primary key
      • Hybrids
      • Enums
      • Get Current User
    • SQL
    • SQL (using named parameters)
    • Advanced SQL
    • Expression Binding
    • Server-side logic & customization [v16+]
      • Service Hoster
      • Starting / stopping hosted services
      • Changes to scheduled jobs!
      • Business Object Proxies
      • Business Object API
    • Colors in Expression Bindings [v15+]
    • Theming
      • Icons
  • TimeLine Developer (TLD)
    • Debugging in TLD
    • Targets
    • Custom Project Rework [v16+]
  • TimeLine-specific LL functions
  • Stunnel proxy
    • Pre-requisites
    • 1. Initial setup
    • 2. Generate the server/web certificates
    • 3.a. Generating client certificates using the CSR flow
    • 3.b. Generate client certificates from the server console
    • 4. Setting up the E3 client connection
    • 5. Setting up the browser certificates
  • Configuration
    • Configuring the WCF timeout
  • Troubleshooting the E3 Bridge
  • [Deprecated]
    • TimeLine WEB - deprecated in v16+
      • Prerequisites for running the WASM modules on the server
      • Prerequisites for developing WASM modules with TLD
      • Creating a small web module with TLD
      • Terminal Configuration
    • Customization Examples - deprecated in v16+
    • Codestore [deprecated]
    • Configuring the scheduled jobs timeout - deprecated in v16+
Powered by GitBook
On this page
  • BusinessObject Introduction
  • BusinessObject Lifecycle
  • BusinessObject Initialization
  1. Framework

BusinessObject

BusinessObject Introduction

When you first create a BusinessObject it will naturally be the ‘master’, aka the one that creates the transaction. But in time it should be able to be consumed by another parent business object. In order to support this, we have to ensure that we have a transaction in our business object at the moment of creation, either by getting it from a parent object, or one gets created if none was provided. The moment where the object knows whether it got a transaction from the parent context is the Init method (explained below).

BusinessObject Lifecycle

  • Constructor call

  • Context passing (this is where the transaction gets passed from the parent businessobject if it gets created through CreateChildBusinessObject)

  • Init function call

BusinessObject Initialization

Never create BusinessObjects using new!!!

  • do NOT create child businessobjects in the constructor of the BusinessObject, as it does not (yet) have the transaction information available

  • use BusinessObjectFactory.CreateBusinessObject<T>(Transaction transaction) if you have a Transaction instance but you are not in the context of a BusinessObject (e.g. if you create a BusinessObject in a response window which got the Transaction from the main module). It's the main method. The transaction must be explicitly passed (can be null).

  • use myBusObj.CreateChildBusinessObject<T>(bool addToChildCollection), if you are within a Business Object and want to create a sub-BusinessObject

    • we call CreateChildBusinessObject(addToChildCollection: true) in busObj.Init(), when the child BusObj must remain permanently a child of the initial busObj

    • we call CreateChildBusinessObject(addToChildCollection: false) when the child BusObj has a local lifecycle

  • The default value is addToChildCollection = true.

  • when setting the Transaction property, the main DataSet (the ‘dSet’ property) receives the transaction as well. No need to pass it explicitly

Init function implementation example:

public override void Init()
{
    base.Init();

    //this is how we check if we already have a transaction 
    //(passed from another business object) 
    Transaction.VerifyNotNullTransaction(this);

    // here we create the child business objects
    if (boBab == null)
    {
        boBab = this.CreateChildBusinessObject<busBabKoppelprodukt>();
    }

    if (boKalk == null)
    {
        boKalk = this.CreateChildBusinessObject<busKalk>();
    }
}
PreviousAdding DMS Tab to a ModuleNextControls

Last updated 3 years ago