DatasetModel QueryStyle property

 

The QueryStyle property on the Consultingwerk.OERA.IDatasetModel interface and related classes (like Consultingwerk.OERA.DatasetModelPerformer) controls how query expressions are added to the Consultingwerk.OERA.IFetchDataRequest implementations used to retrieve data by a dataset model. This property is used in the dataset model’s RetrieveData methods that have a parameter defined as Consultingwerk.IQueryExpression . RetrieveData methods that do not have such a parameter are not affected by this change.

The QueryStyle property is publicly writeable. The default value is Consultingwerk.OERA.DatasetModel.QueryStyleEnum:QueryString .

QueryStyle property value

Behaviour in RetrieveData()

QueryStyle property value

Behaviour in RetrieveData()

QueryString

The query expression object’s expression is added as a character value to an ABL FOR EACH statement. If a sort string is passed in, it is added to the FOR EACH statement. The resulting string is added as the FetchDataRequest object’s Queries property.

This is the default behaviour.

QueryExpressionWithSort

The query expression is assigned to the FetchDataRequest object’s QueryExpressionWithSort property, together with a sort string, if a valid value is passed in.

DetectFromBusinessEntity

The dataset model’s Business Entity is inspected to determine whether it implements the Consultingwerk.OERA.ISupportsQueryExpressionWithSort marker interface or not. If it does, then the QueryExpressionWithSort behaviour is used. If the Business Entity does not implement the interface, the QueryString behaviour is used.

If the value of the dataset model’s UseInterface property is Consultingwerk.OERA.UseInterfaceEnum:ServiceAdapter, then an Consultingwerk.OERA.Exceptions.UnableToDetermineQueryStyleException will be thrown, since the dataset model cannot directly inspect the Business Entity class.

 

Marker interface

The Consultingwerk.OERA.ISupportsQueryExpressionWithSort marker interface is optional, and should be added to Business Entities where the use of the QueryExpressionWithSort behaviour described above is desired.

Business Entity Designer

The Business Entity Designer’s dataset model generation looks for this interface when generating *DatasetModel_Generated classes. The value of the QueryStyle property is set in the constructor to either Consultingwerk.OERA.DatasetModel.QueryStyleEnum:QueryExpressionWithSort or Consultingwerk.OERA.DatasetModel.QueryStyleEnum:QueryString , depending on whether the Business Entity implements the interface or not.