User Friendly Report
From Compare .NET Objects
| Compare .NET Objects | |
| User Friendly Report | |
| Send Feedback | |
| Using Compare .NET Objects > Reports > User Friendly Report |
Glossary Item Box
Sometimes you want to show the differences of an object to a user before they submit their changes to the database. The User Friendly report can be used to do this:
Example
[Test]
public void UserFriendlyReportTest()
{
if (File.Exists("movie.txt"))
File.Delete("movie.txt");
Movie movie1 = new Movie();
movie1.Name = "Oblivion";
movie1.PaymentForTomCruise = 2000000M;
Movie movie2 = new Movie();
movie2.Name = "Edge of Tomorrow";
movie2.PaymentForTomCruise = 3000000M;
CompareLogic compareLogic = new CompareLogic();
compareLogic.Config.MaxDifferences = Int32.MaxValue;
ComparisonResult result = compareLogic.Compare(movie1, movie2);
UserFriendlyReport friendlyReport = new UserFriendlyReport();
friendlyReport.OutputFile(result.Differences, "movie.txt");
Assert.IsTrue(File.Exists("movie.txt"));
Console.WriteLine(friendlyReport.OutputString(result.Differences));
friendlyReport.LaunchApplication("movie.txt");
}