Repository.Model.DeleteModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:APIClass|Repository Class|Repository}} {{Template:Repository.DeleteModel.Cmt}} == Syntax== DeleteModel({{APIPrefix|ByVal}} ID {{APIPrefix|As Integer}}) {{APIPrefix|As…')
 
Line 25: Line 25:
    
    
  {{APIComment|'Delete Model.}}
  {{APIComment|'Delete Model.}}
   MyRepository.DeleteModel(20)
   Dim SucessDeleteModel As Boolean
  SucessDeleteModel = MyRepository.DeleteModel(20)
        
        
  {{APIComment|'Disconnect from the repository.}}
  {{APIComment|'Disconnect from the repository.}}
   MyRepository.DisconnectFromRepository
   MyRepository.DisconnectFromRepository

Revision as of 17:37, 26 March 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.GetAllModelsInfo()
 
 'Retrieve the model with ID = 20. 
 Dim AModel as cModel
 AModel = MyRepository.GetModel(20)
 
 'Delete Model. 
 Dim SucessDeleteModel As Boolean
 SucessDeleteModel = MyRepository.DeleteModel(20)
      
 'Disconnect from the repository. 
 MyRepository.DisconnectFromRepository