Attrs: IOrmSimpleAttrs;
Attrs: Prognoz.Platform.Interop.Orm.IOrmSimpleAttrs;
The Attrs property returns collection of object attributes.
Use the IOrmSimpleAttrs.Item property to get attribute from the collection.
Executing the example requires that the repository contains a simple class object with the DICT identifier. Add links to the Dal, Metabase, Orm and Rds system assemblies.
Sub UserProc;
Var
MB: IMetabase;
RdsDict: IRdsDictionary;
RdsDictInst: IRdsDictionaryInstance;
OrmClass: IOrmSimpleClass;
sAtts: IOrmSimpleAttrs;
Attr: IOrmSimpleAttr;
i: Integer;
s: String;
Begin
MB := MetabaseClass.Active;
RdsDict := MB.ItemById("DICT").Bind As IRdsDictionary;
RdsDictInst := RdsDict.Open(Null);
OrmClass := RdsDict As IOrmSimpleClass;
sAtts := OrmClass.Attrs;
For i := 0 To sAtts.Count - 1 Do
Attr := sAtts.Item(i);
Debug.WriteLine("Attribute:");
Debug.Indent;
Debug.WriteLine("- key: " + Attr.Key.ToString);
Debug.WriteLine("- identifier: " + Attr.Id);
Debug.WriteLine("- name: " + Attr.Name);
Select Case Attr.DataType
Case DbDataType.Blob: s := "binary or character data array";
Case DbDataType.Boolean: s := "logical data";
Case DbDataType.Date: s := "date without time";
Case DbDataType.DateTime: s := "date and time";
Case DbDataType.Float: s := "real values";
Case DbDataType.Integer: s := "integer values";
Case DbDataType.NoData: s := "no data";
Case DbDataType.String: s := "character data";
End Select;
Debug.WriteLine("- data type: " + s);
Debug.Unindent;
End For;
End Sub UserProc;
After executing the example the console window displays information about object attributes.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Orm;
Imports Prognoz.Platform.Interop.Rds;
…
Public Sub Main(Params: StartParams);
Var
MB: IMetabase;
RdsDict: IRdsDictionary;
RdsDictInst: IRdsDictionaryInstance;
OrmClass: IOrmSimpleClass;
sAtts: IOrmSimpleAttrs;
Attr: IOrmSimpleAttr;
i: Integer;
s: String;
Begin
MB := Params.Metabase;
RdsDict := MB.ItemById["DICT"].Bind() As IRdsDictionary;
RdsDictInst := RdsDict.Open(Null);
OrmClass := RdsDict As IOrmSimpleClass;
sAtts := OrmClass.Attrs();
For i := 0 To sAtts.Count - 1 Do
Attr := sAtts.Item[i];
System.Diagnostics.Debug.WriteLine("Attribute:");
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("- key: " + Attr.Key.ToString());
System.Diagnostics.Debug.WriteLine("- identifier: " + Attr.Id);
System.Diagnostics.Debug.WriteLine("- name: " + Attr.Name);
Select Case Attr.DataType
Case DbDataType.ddtBlob: s := "binary or character data array";
Case DbDataType.ddtBoolean: s := "logical data";
Case DbDataType.ddtDate: s := "date without time";
Case DbDataType.ddtDateTime: s := "date and time";
Case DbDataType.ddtFloat: s := "real values";
Case DbDataType.ddtInteger: s := "integer values";
Case DbDataType.ddtNoData: s := "no data";
Case DbDataType.ddtString: s := "character values";
End Select;
System.Diagnostics.Debug.WriteLine("- data type: " + s);
System.Diagnostics.Debug.Unindent();
End For;
End Sub;
See also: