title: How to make AutoMapper call a method after mapping a ViewModel
body: <p>Is it possbile to make AutoMapper call a method after mapping source and destination?</p>
  
  <p>My ViewModel looks like this:</p>
  
  <pre><code> public class ShowCategoriesViewModel
  {
      public int category_id { get; set; }
      public string category_name { get; set; }
  
      public List&lt;MvcApplication3.Models.Category&gt; SubCategories { get; set; }
  
      public void Sort()
      {
          SubCategories.Sort(new CompareCategory());
      }
  
  }
  </code></pre>
  
  <p>And my Controller looks like this:</p>
  
  <pre><code>        public ActionResult Index()
      {
          var category = db.Category.Where(y =&gt; y.parrent_id == null).ToList();
  
          Mapper.CreateMap&lt;Category, ShowCategoriesViewModel&gt;().
              ForMember(dest =&gt; dest.SubCategories, opt =&gt; opt.MapFrom(origin =&gt; origin.Category1));
  
          List&lt;ShowCategoriesViewModel&gt; scvm = Mapper.Map&lt;List&lt;Category&gt;, List&lt;ShowCategoriesViewModel&gt;&gt;(category);
  
          foreach (ShowCategoriesViewModel model in scvm)
          {
              model.Sort();
          }
  
          return View(scvm);
      }
  </code></pre>
  
  <p>I would like to have AutoMapper call the <code>Sort()</code> method, instead of doing a <code>foreach</code> loop. Is this possible?</p>