/// <summary> /// Demonstrate writing bins with replace option. Replace will cause all record bins /// to be overwritten. If an existing bin is not referenced in the replace command, /// the bin will be deleted. /// <para> /// The replace command has a performance advantage over the default put, because /// the server does not have to read the existing record before overwriting it. /// </para> /// </summary> public override void RunExample(AerospikeClient client, Arguments args) { // Write securities console.Info("Write securities"); Security security = new Security("GE", 26.89); security.Write(client, args.writePolicy, args.ns, args.set); security = new Security("IBM", 183.6); security.Write(client, args.writePolicy, args.ns, args.set); // Write account with positions. console.Info("Write account with positions"); List <Position> positions = new List <Position>(2); positions.Add(new Position("GE", 1000)); positions.Add(new Position("IBM", 500)); Account accountWrite = new Account("123456", positions); accountWrite.Write(client, args.writePolicy, args.ns, args.set); // Read account/positions and join with securities. console.Info("Read accounts, positions and securities"); Account accountRead = new Account(); accountRead.Read(client, null, args.ns, args.set, "123456"); // Validate data accountWrite.Validate(accountRead); console.Info("Accounts match"); }
/// <summary> /// Demonstrate writing bins with replace option. Replace will cause all record bins /// to be overwritten. If an existing bin is not referenced in the replace command, /// the bin will be deleted. /// <para> /// The replace command has a performance advantage over the default put, because /// the server does not have to read the existing record before overwriting it. /// </para> /// </summary> public override void RunExample(AerospikeClient client, Arguments args) { // Write securities console.Info("Write securities"); Security security = new Security("GE", 26.89); security.Write(client, args.writePolicy, args.ns, args.set); security = new Security("IBM", 183.6); security.Write(client, args.writePolicy, args.ns, args.set); // Write account with positions. console.Info("Write account with positions"); List<Position> positions = new List<Position>(2); positions.Add(new Position("GE", 1000)); positions.Add(new Position("IBM", 500)); Account accountWrite = new Account("123456", positions); accountWrite.Write(client, args.writePolicy, args.ns, args.set); // Read account/positions and join with securities. console.Info("Read accounts, positions and securities"); Account accountRead = new Account(); accountRead.Read(client, null, args.ns, args.set, "123456"); // Validate data accountWrite.Validate(accountRead); console.Info("Accounts match"); }