Person |
Imports the list of persons.
If a person already exists, they will be updated and if they do not exist, they will be created.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void Import( ISimpleCollection<SimplePersonV1> persons )
Parameters
- persons ISimpleCollection<SimplePersonV1>
- The persons.
Implements
ISimpleClientPersonRepositoryV1.Import(ISimpleCollection<SimplePersonV1>)Example
The following example illustrates how the SimpleClient imports persons.
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(); //If a person already exists, they will be updated and if they do not exist, they will be created. // Create new Example Person var examplePerson = new SimplePersonV1( Guid.NewGuid(), EntityRoot.Person, PersonCategory.Person); examplePerson.Data["Surname"] = "Example"; // Create examplePerson in database client.Persons.Create(examplePerson); examplePerson.Data["Surname"] = "Brown"; var examplePersonToImport = new SimplePersonV1( Guid.NewGuid(), EntityRoot.Person, PersonCategory.Person); examplePersonToImport.Data["Surname"] = "Example"; var examplePersonsToImport = new SimpleCollection<SimplePersonV1>() { examplePerson, examplePersonToImport }; // import client.Persons.Import(examplePersonsToImport); var result = client.Persons.GetAll(); // Console ouptut should include surnames 'Brown' for updated person and 'Example' for imported person foreach(var resultPerson in result) { Console.WriteLine(resultPerson.Name); } // Disconnect from server client.Disconnect(); } }
See Also