protected override void Create() { var element = new AxEdtString { Name = ElementName, }; MetaService.CreateExtendedDataType(element, Model); }
void DoEdtCreate() { if (_axHelper.MetadataProvider.Edts.Read(PrimaryKeyEdtName) != null) { return; } //need to create a EDT AxEdtString newEdt = new AxEdtString(); newEdt.Name = PrimaryKeyEdtName; newEdt.Extends = EdtExtends; if (EdtStrLen > 0 && newEdt.Extends == String.Empty) { newEdt.StringSize = EdtStrLen; } newEdt.Label = EdtLabel; newEdt.HelpText = EdtHelpText; _axHelper.MetaModelService.CreateExtendedDataType(newEdt, _axHelper.ModelSaveInfo); _axHelper.AppendToActiveProject(newEdt); AddLog($"EDT: {newEdt.Name}; "); }
public AxEdt BuildEdt() { var edt = _axHelper.MetadataProvider.Edts.Read(EdtText); if (edt != null) { IsEdtExist = true; } else { switch (FieldType) { case FieldType.String: var edtString = new AxEdtString(); if (NewStrEdtLen > 0 && ExtendsText == String.Empty) { edtString.StringSize = NewStrEdtLen; } edt = edtString; break; case FieldType.Integer: edt = new AxEdtInt(); break; case FieldType.Real: edt = new AxEdtReal(); break; case FieldType.DateTime: edt = new AxEdtUtcDateTime(); if (ExtendsText == String.Empty) { edt.Extends = "TransDateTime"; } break; case FieldType.Guid: edt = new AxEdtGuid(); break; case FieldType.Int64: edt = new AxEdtInt64(); break; case FieldType.Enum: AxEdtEnum edtEnum = new AxEdtEnum(); AxEdtEnum edtLocal = _axHelper.MetadataProvider.Edts.Read(ExtendsText) as AxEdtEnum; if (edtLocal != null) { edtEnum.EnumType = edtLocal.EnumType; } edt = edtEnum; break; case FieldType.Time: edt = new AxEdtTime(); break; case FieldType.Container: edt = new AxEdtContainer(); break; case FieldType.Memo: edt = new AxEdtString(); if (ExtendsText == String.Empty) { edt.Extends = "FreeTxt"; } break; case FieldType.Date: edt = new AxEdtDate(); if (ExtendsText == String.Empty) { edt.Extends = "TransDate"; } break; default: throw new NotImplementedException( $"Field type {FieldType.ToString()} is not supported"); } edt.Name = EdtText; if (ExtendsText != string.Empty) { edt.Extends = ExtendsText; } if (LabelText != String.Empty) { edt.Label = LabelText; } if (HelpTextText != String.Empty) { edt.HelpText = HelpTextText; } } return(edt); }