Credential |
Delete existing credential.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void Delete( CredentialV1 credential )
Parameters
- credential CredentialV1
- The credential.
Implements
ISimpleClientCredentialRepositoryV1.Delete(CredentialV1)Example
The following example illustrates how the SimpleClient deletes credential
C#
using System; using Gamanet.C4.SDK; using Gamanet.C4.SimpleInterfaces; public class Example { static void Main() { // Create instance of simple client var client = new SimpleClient(ConnectorConfiguration.HttpClient); ConnectionInfoV1 token; // Connect to local server var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); if (connectionResult != ConnectionResult.Successful) { Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult); return; } Console.WriteLine("Connection result: {0}", connectionResult); Console.WriteLine(); // You have to install package for credential type first // Create example credential data var exampleCard = new CredentialV1(Guid.NewGuid(), exampleCredentialTypeId) // CredentialCategory.Card { Code = "0x457", Name = "ExampleCard", OwnerId = EntityRoot.Person, HolderId = Guid.Empty, // Undefined holder for example purposes Status = CredentialStatus.Enabled }; // Create credential in database client.Credentials.Create(exampleCard); //Check if credential exists var createdCredential = client.Credentials.Get(exampleCard.Id); if(createdCredential != null) { Console.WriteLine(createdCredential.Name); } // Delete example credential client.Credentials.Delete(exampleCard); var exampleResult = client.Credentials.Get(exampleCard.Id); if (exampleResult == null) { Console.WriteLine("Credential deleted"); } // Disconnect from server client.Disconnect(); } }
See Also