세 가지 프로젝트가있는 하나의 솔루션이 있습니다.ADO.NET Entity Framework와 ASP.MVC의 조합이 잘못 되었습니까?
- DomainModel (ADO.NET 엔티티 프레임 워크와 C# 라이브러리)
- DomainModelTest (단위 테스트 비즈니스를위한 논리)
- 웹 애플리케이션 (DomainModel 사용)
어떤 이유로, 심지어 가져올 수 없습니다 DomainModel에있는 객체 중 하나를 전달한 경우 뷰는 단순하지 않습니다. 아래 오류가 발생합니다.
아이디어가 있으십니까?
나는이 도움이 될 거라고 생각Compiler Error Message: CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Source Error:
Line 146: Line 147:
[System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()] Line 148: public class views_home_index_aspx : System.Web.Mvc.ViewPage, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler { Line 149:
Line 150: private static bool @__initialized;
, 실제 오류가 라인에서 Default.aspx를 파일에 나오면 아래 지적 :
public partial class _Default : Page
{
public void Page_Load(object sender, System.EventArgs e)
{
// Change the current path so that the Routing handler can correctly interpret
// the request, then restore the original path so that the OutputCache module
// can correctly process the response (if caching is enabled).
string originalPath = Request.Path;
HttpContext.Current.RewritePath(Request.ApplicationPath, false);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current); //**HERE**
HttpContext.Current.RewritePath(originalPath, false);
}
}
웹 프로젝트에서 System.Data.Entity에 대한 참조를 추가 했습니까? – JasonTrue
@ Jason. 그래, 내가 했어. 나는 그것을 제거했다. 다시 추가했다. 심지어 버전을 확인하고 homecontroller에서 문장을 사용해 보았다. 나는 그것이 내 생각이라고 생각했기 때문에 나는 그것을 삭제하고 다시 만든다. 그것들이 ado.net 엔티 프레임에 의해 생성 된 객체에 대한 참조를 만들지 않는다면, 사용자 나 다른 객체를 시도하자마자 컴파일 오류가 발생합니다. 감사. – Geo
가 여기에 내가 컴파일 문제를 해결하는 방법 해답을 발견 [http://stackoverflow.com/a/5129828/305197][1] [1] : http://stackoverflow.com/ a/5129828/305197 –