Repository.Model.DeleteModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
Line 18: Line 18:
  {{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]]
   ListOfModels = MyRepository.GetAllModelsInfo()
   ListOfModels = MyRepository.Model.GetAllModelsInfo()
    
    
  {{APIComment|'Retrieve the model with ID = 20.}}
  {{APIComment|'Retrieve the model with ID = 20.}}
   Dim AModel as cModel
   Dim AModel as cModel
   AModel = MyRepository.GetModel(20)
   AModel = MyRepository.Model.GetModel(20)
    
    
  {{APIComment|'Delete Model.}}
  {{APIComment|'Delete Model.}}
   Dim SucessDeleteModel As Boolean
   Dim SucessDeleteModel As Boolean
   SucessDeleteModel = MyRepository.DeleteModel(20)
   SucessDeleteModel = MyRepository.Model.DeleteModel(20)
        
        
  {{APIComment|'Disconnect from the repository.}}
  {{APIComment|'Disconnect from the repository.}}
   MyRepository.DisconnectFromRepository
   MyRepository.DisconnectFromRepository

Revision as of 16:30, 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")
 
 '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