Ever felt the need to log what your ECO persistence server is up to?

This article was moved to MDriven Wiki Ever felt the need to log what your ECO persistence server is up to?

  1. public partial class ModelPMP : Eco.Persistence.PersistenceMapperProvider
  2. {
  3.     List<string> _log = new List<string>();
  4.     public ModelPMP() : base()
  5.     {
  6.       EcoListener.StartListening();
  7.       EcoLogSwitches.LogSql = true;
  8.       EcoListener.Singleton.OnTraceLog += new TraceLogHandler(OnTraceLog);
  9.       this.InitializeComponent();
  10.     }
  11.     private void OnTraceLog(object sender, TraceEventArgs e)
  12.     {
  13.       if (e.Category.Equals(EcoTraceCategories.Sql))
  14.       {
  15.         _log.Add(e.Message);
  16.       }
  17.     }

The code above is one way…

To make an ExpressionHandle actually load all rows in as few batches as possible go like this:

  1. IObjectList il=(ehPerson.Element as IObjectList);
  2. il.EnsureObjects();
This entry was posted in SourceCode. Bookmark the permalink.

2 Responses to Ever felt the need to log what your ECO persistence server is up to?

  1. Cary says:

    Thanks a bunch for spending some time to describe the terminlogy to the inexperienced persons!

  2. Andrey says:

    Hello.
    Is it possible to use mentioned way to log changes for objects? For example, when I call UpdateDatabase() or CommitTransaction(), I need somehow to get old object, new object, compare them and if any changes log it.

    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.