유형 "ContextModule"을로드하고 나는이 문제로 실행 할 수 없습니다 :이파서 오류 메시지 : 난 그냥 asp.net의 MVC3를 배우기 시작했다
내가 비주얼 스튜디오 2010을 사용하고, 그리고 빌드 도중 오류가 발생하지 않았을 때만 애플리케이션을 실행하려고했습니다. Google에서 답변을 찾고 있는데 성공하지 못했습니다. 누구든지이 문제를 해결하는 방법을 알고 있습니까?
감사합니다.
EDIT-ContextModule 코드 :
using System;
using System.Web;
namespace testbaza.Models
{
public class ContextModule : IHttpModule
{
internal const string CONTEXT_KEY = "datacontext";
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.PostRequestHandlerExecute += new EventHandler(context_PostRequestHandlerExecute);
context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
}
private void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
if (HttpContext.Current.Session != null)
{
HttpContext.Current.Session[CONTEXT_KEY] = new EntitiesModel();
}
}
private void context_PostRequestHandlerExecute(object sender, EventArgs e)
{
CommitTransactions();
DisposeContext();
ClearSession();
}
private void CommitTransactions()
{
if (HttpContext.Current.Session == null)
{
return;
}
EntitiesModel dbContext =
HttpContext.Current.Session[CONTEXT_KEY] as EntitiesModel;
if (dbContext != null)
{
dbContext.SaveChanges();
}
}
private void DisposeContext()
{
if (HttpContext.Current.Session == null)
{
return;
}
EntitiesModel dbContext =
HttpContext.Current.Session[CONTEXT_KEY] as EntitiesModel;
if (dbContext != null)
{
dbContext.Dispose();
}
}
private void ClearSession()
{
if (HttpContext.Current.Session == null)
{
HttpContext.Current.Session.Remove(CONTEXT_KEY);
}
}
}
}
이 비디오에 표시된대로 모듈과 프로젝트를 만들었습니다. http://tv.telerik.com/watch/orm/building-a-mvc-3-application-database-first-with-openaccess-creating-model – user1598696
@ user1598696 ContextModule의 소스 코드를 게시 할 수 있습니까? 네임 스페이스 등을 확인할 수 있습니까? – Xharze
편집에 내 코드를 게시했습니다. 도움을 주셔서 감사합니다. – user1598696