Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

With SCL-591 we have added to utility classes that support developers in mapping .NET Value objects and ABL Temp-Tables, sort of a foundation for ABL to .NET ORM (object-relational mapping).

Creating a dynamic temp-table that matches a .NET Value object

The class Consultingwerk.Windows.TempTableObjectMapping.TempTableFromTypeFactory allows to create a dynamic temp-table that matches the properties of a .NET type.

The class supports primitive types that are mappable between ABL and .NET and Enumeration (either exposed as Integer or Character). The field mapping definition is provided as a comma delimited list with entries in the form of:

  • PropertyName
  • PropertyName|FieldName when the resulting temp-table field name should not match the .NET property name
  • PropertyName|FieldName(ABL DataType) when the resulting temp-table field name or data type should not match the .NET property. This allows to map String properties to either CHARACTER or CLOB or Enumerations to either INTEGER or CHARACTER


Sample code that builds an ABL temp-table from a .NET type
DEFINE VARIABLE cMapping AS CHARACTER NO-UNDO INIT "CustNum|CustomerNumber,Name,City|City(CLOB),Image,ModificationDate|ModDate(DATE),Balance,Weekday,Weekday|Wochentag(CHARACTER)" .
 
/* Get a reference to the .NET Type to map */
oType = Progress.Util.TypeHelper:GetType ("Consultingwerk.DotNetClassLibrary.SampleViewModel", TRUE) .
 
oFactory = NEW TempTableFromTypeFactory () .  
 
hTable = oFactory:CreateTempTable (oType,    /* Reference to the .NET Type */
                                   cMapping, /* Property/Field Mapping definition */
                                   "CustNum" /* Primary unique key fields for the temp-table */) .


 

  • No labels