Exemple #1
0
 /// <summary>
 /// retrieve one match from Peoples table in the database using its Id
 /// </summary>
 /// <param name="Id"></param>
 private static void PrintPerson(int Id)
 {
     try
     {
         // initialize the connection builder
         var factory = new UnitOfWorkFactory(ConnectionString);
         // initialize the repository with transaction explicitly set to false
         // set the errors
         Retry.AddError(207, "Sem descricao");
         using (var uow = factory.Create(false))
         {
             var person = uow.Get(new GetPersonByIdCommand <int>(Id)).FirstOrDefault();
             Console.WriteLine($"Person: {person?.Name} ({person?.Address?.Street})");
         }
     }
     catch (Exception ex)
     {
         // print the error in console
         Console.WriteLine(ex.Message);
     }
 }