title: C# dynamically create instance of a datacontext model
body: <p>I want to dynamically create an instance of a model and return results like below.  How can I do this?</p>
  
  <pre><code>public JsonResult GetDetail(string model, int id)
  {
      Type type = Type.GetType("MyProject.WebApplication.Models.MyProjctContext." + model);            
      var result = (type)Activator.CreateInstance(type).Find(id);
  
      return Json(new
      {
          data = result
      },
      JsonRequestBehavior.AllowGet);
  }
  </code></pre>