Ever felt the need to log what your ECO persistence server is up to?
(Created page with "public partial class ModelPMP : Eco.Persistence.PersistenceMapperProvider {     List<string> _log = new List<string>();     public ModelPMP() : base()     {    ...")
 
(Automatically adding template at the end of the page.)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
public partial class ModelPMP : Eco.Persistence.PersistenceMapperProvider
public partial class ModelPMP : Eco.Persistence.PersistenceMapperProvider
{
  {
    List<string> _log = new List<string>();
  List<string> _log = new List<string>();
    public ModelPMP() : base()
  public ModelPMP() : base()
    {
  {
      EcoListener.StartListening();
  EcoListener.StartListening();
      EcoLogSwitches.LogSql = true;
  EcoLogSwitches.LogSql = true;
      EcoListener.Singleton.OnTraceLog += new TraceLogHandler(OnTraceLog);
  EcoListener.Singleton.OnTraceLog += new TraceLogHandler(OnTraceLog);
      this.InitializeComponent();
  this.InitializeComponent();
    }
  }
private void OnTraceLog(object sender, TraceEventArgs e)
  {
  if (e.Category.Equals(EcoTraceCategories.Sql))
  {
    _log.Add(e.Message);
  }
}
The code above is one way to do it.


    private void OnTraceLog(object sender, TraceEventArgs e)
To make an ExpressionHandle load all rows in as few batches as possible, do this:
    {
IObjectList il=(ehPerson.Element as IObjectList);
      if (e.Category.Equals(EcoTraceCategories.Sql))
il.EnsureObjects();
      {
[[Category:ECO]]
        _log.Add(e.Message);
{{Edited|July|12|2024}}
      }
    }
The code above is one way…
 
To make an ExpressionHandle actually load all rows in as few batches as possible go like this:
 
IObjectList il=(ehPerson.Element as IObjectList);
il.EnsureObjects();

Latest revision as of 15:34, 10 February 2024

public partial class ModelPMP : Eco.Persistence.PersistenceMapperProvider
 {
  List<string> _log = new List<string>();
  public ModelPMP() : base()
 {
  EcoListener.StartListening();
  EcoLogSwitches.LogSql = true;
  EcoListener.Singleton.OnTraceLog += new TraceLogHandler(OnTraceLog);
  this.InitializeComponent();
 }

private void OnTraceLog(object sender, TraceEventArgs e)
 {
  if (e.Category.Equals(EcoTraceCategories.Sql))
  {
   _log.Add(e.Message);
  }
}

The code above is one way to do it.

To make an ExpressionHandle load all rows in as few batches as possible, do this:

IObjectList il=(ehPerson.Element as IObjectList);
il.EnsureObjects();
This page was edited 96 days ago on 02/10/2024. What links here