
Untitled
By: a guest on
May 2nd, 2012 | syntax:
None | size: 0.61 KB | hits: 12 | expires: Never
How to dispose objects correctly (ASP.NET MVC Entity Framework)
public ActionResult Detail(Guid id)
{
Attachment attachment = null;
using (var attachmentRepository = IoC.Resolve<AttachmentRepository>())
{
attachment = attachmentRepository.SelectByKey(id);
return View("Detail", attachment);
}
}
public ActionResult Detail(Guid id)
{
Attachment attachment = null;
var attachmentRepository = IoC.Resolve<AttachmentRepository>();
attachment = attachmentRepository.SelectByKey(id);
return View("Detail", attachment);
}