Why does “Dispose” work, and not “using(var db = new DataContext())”?
问题 I'm creating a forum which is made up of topics, which are made up of messages. When I try to implement the topic View in my Controller with: public ActionResult Topic(int id) //Topic Id { using (var db = new DataContext()) { var topic = db.Topics.Include("Messages").Include("Messages.CreatedBy").Include("CreatedBy").FirstOrDefault(x => x.Id == id); //include the messages for each topic, and when they were created so that the last message can be displayed on the topic page return topic !=