eBiss 3

Hilfe & Dokumentation

User Tools

Site Tools


en:transformation:mappings:objektdefinition:klassenaufbau:class_dbintegration

Example of database integration:

The class structure of the same ORDERS object is displayed here, but now for a database integration. The class ORDERS implements the interface DbAdapterTypeBase. This converts the object definition to the corresponding SELECT statement when reading from the source database using the BackendObjectRetriever. As a rule the attribute ReadMarker() is used to mark records as read. Then an UPDATE statement is also executed after the SELECT. When writing with the BackendObjectTransmitter, corresponding INSERT statements are generated.

Sample C# Code

using System;
using System.Collections;
using eBiss.Api;
using eBiss.DbAdapter;
 
namespace XYZ.DB
{
    public class ORDERS : DbAdapterTypeBase
    {
        [MapTrigger, MapExternalName("ORDERSKOPF")]
        public ORDERS_HEADER HEADER;
    }
 
    public class ORDERS_HEADER : IMapObjectItem
    {
        public Decimal PK_ORDERSKOPF;
        [MapSize(35)]
        public string DOCNUMBER;
        public DateTime DOCDATE;
        [MapSize(35)]
        public string ORDERTYPE;	
        public DateTime DELIVERYDATEFROM;
        public DateTime DELIVERYDATETO;	
        [MapFrameDocumentRecipient, MapSize(13)]
        public string SU_GLN;
        [MapFrameDocumentSender, MapSize(13)]
        public string BUYERGLN;
        [MapSize(13)]
        public string DELIVERYPARTYGLN;
        [MapSize(13)]
        public string ULTIMATECONSIGNEEGLN;
        [MapSize(13)]
        public string INVOICERECEIPIENTGLN;
        [MapSize(3)]
        public string XYZ_WCD; //XYZ Währungscode
        [MapSize(1)]
        [ReadMarker(ReadMarkerType.CheckUpdate, "N", "V")]
        public string MUTATION_Type;
        [ReadMarker(ReadMarkerType.Timestamp)]
        public DateTime MUTATION_Date;
 
        [MapListType(typeof(ORDERS_DETAIL)), MapExternalName("ORDERSDETAIL")]
        public ArrayList DETAIL;
 
    }
 
    public class ORDERS_DETAIL : IMapObjectItem
    {
        public Decimal PK_ORDERSDETAIL;
        [Relation("PK_ORDERSKOPF")]
        public Decimal PK_ORDERSKOPF;
        public Int32 POSNUMBER;	
        public string EAN;	
        public int ORDEREDQUANTITY;	
        public decimal PURCHASEPRICENET;
        [MapSize(3)]
        public string PURCHASEPRICENETCURRENCY;
        [MapSize(1)]
    }	
}

The class ORDERS_HEADER contains the header information of the ORDERS and implements the interface IMapObjectItem. This may occur once per file. The attribute MapExternalName (“ORDERSKOPF”) is used to explicitly determine the table name of the header data and the table name of the detailed data is declared with MapExternalName (“ORDERSDETAIL”). The relationship of the details to the header data is created here using the mapping attribute[Relation (“PK_ORDERSKOPF”)] to data element public Decimal PK_ORDERSKOPF;.

Note: using eBiss.DbAdapter;

reading marks

If data are read out, this must be noted in a suitable way so that they are not read again. In practice, two methods are used:

  1. Note the read operation in a separate STATUS1) table2)
  2. Note the read operation on the records themselves.3)

The shown example uses the mapping attribute ReadMarker () as follows:

        [ReadMarker(ReadMarkerType.CheckUpdate, "N", "V")]
        public string MUTATION_Type;
        [ReadMarker(ReadMarkerType.Timestamp)]
        public DateTime MUTATION_Date;

The attribute ReadMarkerType. CheckUpdate uses the first parameter “N” as a filter in the WHERE-Clause for a SELECT and after the select an UPDATE statement with the second parameter “V” is executed on the attributed data element.

CheckUpdate is an alternative to the attribute ReadMarkerType. UpdateOnly:

        [ReadMarker(ReadMarkerType.UpdateOnly, DoneVal = "UPDATED")]
        public string MUTATION_Type;

oder:

        [ReadMarker(ReadMarkerType.UpdateOnly, DoneVal = "$UpdateVariable")]
        public string MUTATION_Type;

This attribute offers the possibility to add fixed values or values from variables to a dataset without checking them like ReadMarker. CheckUpdate.

1)
This table requires three fields: TypeName (Char), DocumentId (Char) and ReadTimeStamp (DateTime).
2)
This method is used if the database does not provide any checkboxes or should not be read-only..
3)
This is, due to easier applicability and better performance, the preferred method.
en/transformation/mappings/objektdefinition/klassenaufbau/class_dbintegration.txt · Last modified: 2024/02/20 08:15 by 127.0.0.1