<commit_before>﻿using System.Collections.Generic;
using Xyperico.Agres.Contract;


namespace Xyperico.Agres
{
  public abstract class AbstractAggregate<TId> : IHaveIdentity<TId>
    where TId : IIdentity
  {
    const string RestoreMethodName = "RestoreFrom";

    protected List<IEvent> Changes { get; set; }

    
    public AbstractAggregate()
    {
      Changes = new List<IEvent>();
    }


    public TId Id { get; protected set; }


    public IEnumerable<IEvent> GetChanges()
    {
      return Changes;
    }


    protected void Publish(IEvent e)
    {
      Changes.Add(e);
      Mutate(e);
    }


    protected void Mutate(IEnumerable<IEvent> events)
    {
      foreach (IEvent e in events)
        Mutate(e);
    }


    protected void Mutate(IEvent e)
    {
      MethodInvoke.InvokeMethodOptional(this, RestoreMethodName, e);
    }
  }
}<commit_msg>ToString on abstracte aggregate.<commit_after>﻿using System.Collections.Generic;
using Xyperico.Agres.Contract;


namespace Xyperico.Agres
{
  public abstract class AbstractAggregate<TId> : IHaveIdentity<TId>
    where TId : IIdentity
  {
    const string RestoreMethodName = "RestoreFrom";

    protected List<IEvent> Changes { get; set; }

    
    public AbstractAggregate()
    {
      Changes = new List<IEvent>();
    }


    public TId Id { get; protected set; }


    public IEnumerable<IEvent> GetChanges()
    {
      return Changes;
    }


    protected void Publish(IEvent e)
    {
      Changes.Add(e);
      Mutate(e);
    }


    protected void Mutate(IEnumerable<IEvent> events)
    {
      foreach (IEvent e in events)
        Mutate(e);
    }


    protected void Mutate(IEvent e)
    {
      MethodInvoke.InvokeMethodOptional(this, RestoreMethodName, e);
    }


    public override string ToString()
    {
      return string.Format("{0}({1})", GetType(), Id);
    }
  }
}
{'fraction_non_alphanumeric': 0.10161290322580645, 'fraction_numerical': 0.001075268817204301, 'mean_word_length': 2.677865612648221, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5389489', 'n_tokens_mistral': 606, 'n_tokens_neox': 581, 'n_words': 135}