title: What controller Initialize function does ASP.Net MVC4
body: <p>i am new in MVC and learning. here i am putting some code. so see first</p>
  
  <pre><code>public class HomeController : BaseController
      {
          private IProductRepository productRepository;
          private string strRouteValue;
  
          protected override void Initialize(System.Web.Routing.RequestContext requestContext)
          {
              base.Initialize(requestContext);
              strRouteValue = this.ControllerContext.RouteData.Values["method"].ToString();
              this.productRepository = Factory.Create(strRouteValue);
          }
  
          [HttpGet]
          public ActionResult Index(int id)
          {            
              productRepository.Get(id);
              return View();
          }
  
          [HttpPost]
          public ActionResult Index(Product model)
          {
              productRepository.Add(model);            
              return View();
          }       
      }
  </code></pre>
  
  <p>what Initialize function does ?</p>
  
  <p>every one must say this is where people would init many object, if so then we can do it in constructor of controller too. so what is special about  controller Initialize function ?</p>
  
  <p>what is difference between controller Initialize function and controller constructor ?</p>