Skip to content

Server BSO

DeclanBuckley edited this page Jan 25, 2021 · 11 revisions

Home / Developer / Server Tier / BSO

BSO (Business System Object) definition and example.

Summary.

A BSO is a Business System Object. This object usually concerns itself with the details of the Business rules. If a BSO is called by an API, it is usually required to inherit one of the BaseTemplate classes.

BSO Example.

Note the following:

  • The class inherits a BaseTemplate class (BaseTemplateRead in this case).
  • The constructor injects the existing request object and a new validator. Note that the Validator is specific to this BSO.
  • The class must implement HasPrivilege() and Execute().
  • Response.data holds the API output and returns it to the API class.

namespace PxStat.System.Settings { internal class Language_BSO_Read : BaseTemplate_Read<Language_DTO_Read, Language_VLD_Read> { internal Language_BSO_Read(JSONRPC_API request) : base(request, new Language_VLD_Read()) { }

    override protected bool HasPrivilege()
    {
        return true;
    }

    protected override bool Execute()
    {
        //Validation of parameters and user have been successful. We may now proceed to read from the database
        var adoLanguage = new Language_ADO(Ado);

        //Languages are returned as an ADO result
        ADO_readerOutput result = adoLanguage.Read(DTO);

        if (!result.hasData)
        {

            return false;
        }


        Response.data = result.data;

        return true;
    }
}

}

Clone this wiki locally