===== DbAdapter Object Attributes =====
Depending on class **eBiss.DbAdapter**.
DbAdapter attributes are usually defined as follows for database integration.
==== DynamicTable ====
With this attribute, the data py is only validated against the DB schema during INSERT or UPDATE operations.\\ SELECT operations can be executed although the eBiss object contains fields that do not exist in the DB schema. Useful for eBiss systems with several versions of a backend DB.##DB Schema
CREATE TABLE DynamicTable
(
Id int IDENTITY(1,1) NOT NULL,
CommonField1 Varchar(50) NULL,
RecordType int NOT NULL,
)
GO
//CS Object:
public class DynamicTableDoc : IDbMapObjectRoot
{
[MapTrigger]
public DynamicTable DynamicTable;
}
[DynamicTable]
public class DynamicTable : IMapObjectItem
{
[PrimaryKey(PrimaryKeyType.Auto)]
public int Id;
public string CommonField1;
public int RecordType;
public string NonExistantStringField;
public int NonExistanteIntField;
}
eBiss Log:\\ {{:transformation:mappings:objektdefinition:dynamictablelog.png?nolink|}}|
|**LookupReference()**|[LookupReference(LookupType.Optional, "RefTable", "FieldId", "FieldLookupValue = @VariableRefTableKey")]
public int RefTableRef;
[LookupReference(LookupType.Required, "RefTable", "FieldId", "FieldLookupValue = @VariableRefTableKey")]
public int RefTableRef;
==== PrimaryKey() ====
Select and use the primary key of the table.
[PrimaryKey(PrimaryKeyType.Auto)]//Auto from DB. SQL int primary key field that the server will automatically generate.
public int PrimaryKey;
PrimaryKeyType.GUID //Globally Unique Identifier, if set as primary key field in the DB
[PrimaryKey(PrimaryKeyType.Counter, "TableCounters", "FieldName = 'ValueHeaderTable'", "FieldCurrent")]//Select FieldCurrent from TableCounters where FieldName = 'ValueHeaderTable'. Will read last counter and write the next (always +1)
[MapFrameDocumentNumber]
public int PrimaryKey;
PrimaryKeyType.Max//Not implemented
public int PrimaryKey;
==== PrimaryKey(PrimaryKeyType.Sequence, "seqence name") ====
Für die automatisch Vergabe von Primärschlüsselwerten beim **Microsoft SQL Server** können jetzt SEQUENCE verwendet werden.
Hierzu verwendet man im Attribut PrimaryKey den Parameter **PrimaryKeyType.Sequence** und gibt als zweiten Parameter
den Namen der SEQUENCE an, z.B.:
[PrimaryKey(PrimaryKeyType.Sequence, "TestSequence")]
public int Id;
==== ReadMarker() ====
Mark this field((Exception ReadMarkerType. StatusTable, where a new record is inserted into a dedicated table INSERTed.)) if the data record read under **MapTrigger** is read successfully. There are three different types:\\ [ReadMarker(ReadMarkerType.CheckUpdate, "$foo", "$bar")]//;
[ReadMarker(ReadMarkerType.Timestamp)]//schreibt aktuelles DateTime(im DB ISO Format) des Selects
public DateTime FieldName;
[ReadMarker(ReadMarkerType.UpdateOnly, DoneVal = "$foo")]// aktualisiert FieldName mit $foo
public string FieldName;
[ReadMarker(ReadMarkerType.StatusTable, "StatusTable", true)]// INSERT eines neuen Records in die Tabelle "StatusTable", bei dem unter "DocumentId" der Wert von "DocNumber" mit "ReadTimeStamp" und "TypeName" eingetragen wird.
public string DocNumber;
\\ $foo oder $bar dürfen als String oder auch als Variable verwendet werden.|
|**Where()**|Ein Attribut welches die WHERE-Clause bei SELECT mit AND erweitert.[Where("( ReadTimestamp < $ReadTimestamp AND ReadTimestamp > $ReadTimestamp_2 ) ", true)]
public DateTime ReadTimestamp;
|
|**Relation()**|With the Relation Attribut it is possible to declare the relationship between parent and child records.\\
namespace SAMPLE
{
public class PRICAT : DbAdapterTypeBase
{
[MapTrigger, MapExternalName("PRICAT_HEADER")]
public HEADER HEADER;
}
}
public class HEADER : IMapObjectItem
{
public int ID;
[MapSize(35),MapFrameDocumentNumber]
public string DocNumber;
...
[MapExternalName("PRICAT_DETAILS")]
public List DETAILS;
}
public class DETAILS : IMapObjectItem
{
public int Id;
[Relation("ID")]
public int Pricat_ID;
....