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.
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;
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:
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.