Repository.Model.DeleteModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
Line 16: Line 16:
   Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
   Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
    
    
{{APIComment|'Set a first available project as current.}}
  MyRepository.Project.SetCurrentProject(0)
  {{APIComment|'Get the list of models in the connected repository.}}
  {{APIComment|'Get the list of models in the connected repository.}}
   Dim ListOfModels() As [[NameIdPair Class|NameIdPair]]
   Dim ListOfModels() As [[NameIdPair Class|NameIdPair]]

Revision as of 20:28, 22 May 2015


Checks if the model is not in use and deletes the model. Returns true if success, false otherwise. Throws an exception if the model is in use.

Syntax

DeleteModel(ByVal ID As Integer) As Boolean

Parameters

ID: The ID to delete.

Usage Example

 'Declare a new repository connection object. 
 Dim MyRepository As New Repository
 
 'Connect to the Synthesis repository. 
 Dim Success As Boolean = False
 Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
 'Set a first available project as current. 
 MyRepository.Project.SetCurrentProject(0)

 'Get the list of models in the connected repository. 
 Dim ListOfModels() As NameIdPair
 ListOfModels = MyRepository.Model.GetAllModelsInfo()
 
 'Retrieve the model with ID = 20. 
 Dim AModel as cModel
 AModel = MyRepository.Model.GetModel(20)
 
 'Delete Model. 
 Dim SucessDeleteModel As Boolean
 SucessDeleteModel = MyRepository.Model.DeleteModel(20)
      
 'Disconnect from the repository. 
 MyRepository.DisconnectFromRepository