Dim element as object
Dim idx as integer
Dim attribute as object
Dim method as object
'sólo cargar un elemento por su ID - debe
'sustituir un ID válido de su modelo
element = m_Repository.GetElementByID(246)
''crear un nuevo método
method = element.Methods.AddNew("newMethod", "int")
method.Update
element.Methods.Refresh
'ahora en bucle a través de métodos para el Elemento - y eliminar nuestra adición
For idx = 0 to element.Methods.Count-1
method =element.Methods.GetAt(idx)
Console.Writeline(method.Name)
If(method.Name = "newMethod") Then
element.Methods.Delete(idx)
End if
Next
'crear un atributo
attribute = element.attributes.AddNew("NewAttribute", "int")
attribute.Update
element.attributes.Refresh
"bucle y eliminar nuestro nuevo atributo
For idx = 0 to element.attributes.Count-1
attribute =element.attributes.GetAt(idx)
Console.Writeline(attribute.Name)
If(attribute.Name = "NewAttribute") Then
element.attributes.Delete(idx)
End If
Next
|