MvcContrib의 휴대용 영역을 사용하기 시작했으며 모든 간단한보기가 제대로 작동하지만 내보기에서 사용자 지정 모델을 사용하려고 할 때 네임 스페이스가 존재하지 않는다는 오류가 발생했습니다.ASP.NET MVC 3 - 휴대용 영역보기에서 내 모델을 찾지 못함
보기가 리소스로 포함되도록 설정됩니다. 보기에서 인텔리 센스는 모델을 잘 인식합니다.
아무도 문제를 일으킬 수있는 아이디어가 있습니까?
UPDATE
는 나는 내가 플러그인을로드 할 수 MEF를 사용하고 있다는 사실과 함께해야 할 것 같아요. 나는 컨트롤러를 로딩 할 때 비슷한 문제가 있었다. 나는 기본 controllerfactory에 적합한 컨트롤러가 발견되지 않으면 MEF 컨트롤러 목록을 볼 수있는 사용자 정의 ControllerFactory를 빌드해야했습니다. 2
UPDATE 나는 나의 MEF-로드 어셈블리로 RazorBuildProvider을 제공하여 오류를 제거 할 수 있었다. 그러나 이제보기가 더 이상 발견되지 않습니다. 보기가 강하게 입력되지 않으면 찾을 수 있습니다.
RazorBuildProvider.CodeGenerationStarted += (object sender, EventArgs e) =>
{
RazorBuildProvider provider = (RazorBuildProvider)sender;
foreach (var module in ExternalComponents)
{
provider.AssemblyBuilder.AddAssemblyReference(module.GetType().Assembly);
}
};
소스 코드
모델
namespace Isis.Plugins.TextArea.TextArea.Models
{
public class TextAreaModel
{
[Required(ErrorMessage = "Field is required")]
public string Message { get; set; }
}
}
감사관 :
namespace Isis.Plugins.TextArea.TextArea.Controllers
{
[Export(typeof(IController))]
public class IndexController : Controller
{
[HttpGet]
public ActionResult Index()
{
return View(new TextAreaModel() { Message = "Hallow!" });
}
[HttpGet]
public ActionResult Editor()
{
return View(new TextAreaModel() { Message = "EDITOR CONTENT" });
}
}
}
보기
@model Isis.Plugins.TextArea.TextArea.Models.TextAreaModel
@Model.Message
오류 : 나는 결국 대신 사용자 정의 플러그인 디렉토리의 bin 디렉토리에있는 모든 플러그인을 배치하기로 결정
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Plugins' does not exist in the namespace 'Isis' (are you missing an assembly reference?)
Source Error:
Line 27:
Line 28:
Line 29: public class _Page_Areas_TextArea_Views_Index_Index_cshtml : System.Web.Mvc.WebViewPage<Isis.Plugins.TextArea.TextArea.Models.TextAreaModel> {
Line 30:
Line 31: #line hidden