/ Home / HowTo / DAL

The DAL Test Retrieve() Method

The Update() Method

The inherited PersonManager.Update() method updates the specified dataRecord that matches the key specified by the keyRecord parameter.

// Test the Update function.
private static void TestUpdate(PersonManager personManager)
{
  Console.WriteLine();
  Console.WriteLine("TestUpdate");

  // Toggle "Updated" value to allow for update.
  Person keyRecord = new Person();
  Person dataRecord = GetWithName("AddedUpdated", personManager);
  if (dataRecord != null)
  {
    keyRecord.Name = "AddedUpdated";
    dataRecord.Name = "Added";
  }
  else
  {
    dataRecord = GetWithName("Added", personManager);
    if (dataRecord != null)
    {
      keyRecord.Name = "Added";
      dataRecord.Name = "AddedUpdated";
    }
  }

  // Update the record.
  List columnNames = new List()
  {
    Person.ColumnName
  };
  personManager.SetExcludeKeys();
  personManager.Update(dataRecord, keyRecord, columnNames);
}
if (success)
{
  // Test function calls.
  TestLoad(personManager);
  TestAdd(personManager);
  TestRetrieve(personManager);
  TestUpdate(personManager);

  Console.WriteLine("Press any key to continue . . .");
  Console.ReadKey();
}

The DAL Test Delete() Method
/ Home / HowTo / DAL

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.