CredentialRepository.CombineCredentials Method

Combine the credentials.

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void CombineCredentials(
	ISimpleCollection<Guid> credentialIds,
	Guid combinationId
)

Parameters

credentialIds  ISimpleCollection<Guid>
List Id
combinationId  Guid
The combination identifier. The combination identifier. Can not be Guid.Empty or default.

Implements

ISimpleClientCredentialRepositoryV1.CombineCredentials(ISimpleCollection<Guid>, Guid)
Example
The following example illustrates how the SimpleClient combine credentials
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();

        var exampleCard = new CredentialV1(Guid.NewGuid(), exampleCredentialCardTypeId) // CredentialCategory.Card
        {
            Code = "0x457",
            Name = "ExampleCard",
            OwnerId = EntityRoot.Person,
            HolderId =examplePerson.Id,
            Status = CredentialStatus.Enabled
        };

        var examplePin = new CredentialV1(Guid.NewGuid(), exampleCredentialPinTypeId) // CredentialCategory.Card
        {
            Code = "1234",
            Name = "ExamplePin",
            HolderId = examplePerson.Id,
            Status = CredentialStatus.Enabled
        };

        // Create credential in database
        client.Credentials.Create(exampleCard);
        client.Credentials.Create(examplePin);

        var exampleCredentialIds = new SimpleCollection<Guid>
        {
            exampleCard.Id, examplePin.Id
        };

        // Create combination ID
        var exampleCombinationId = Guid.NewGuid();

        client.Credentials.CombineCredentials(exampleCredentialIds, exampleCombinationId);

        // Get the credential to verify its combined
        var resultCard = client.Credentials.Get(exampleCard.Id);
        var resultPin = client.Credentials.Get(examplePin.Id);

        // Credentials can have multiple combination IDs.
        // This example however has only one, but since CombinationIds is a collection, we need to retrieve the one ID by using First()
        Console.WriteLine($"Card: {resultCard.Name} Card Combination Id: {resultCard.CombinationIds.First()}\n" +
            $"Pin: {resultPin.Name} Card Combination Id: {resultPin.CombinationIds.First()}");

        // Disconnect from server
        client.Disconnect();
    }
}
See Also

Reference

CredentialRepository Class
Gamanet.C4.SDK Namespace
CredentialV1