I'm starting with ASP.NET MVC 3 and modules.
Like the Orchard CMS modules, I want to have modules as assemblies with Razor pages (inside/outside the DLL). I followed Mika Kolari's tutorial, but I don't know how to include all the classes from the assembly namespace in the core project with Castle Windsor.
I'm able to load Controller from the assembly, but not Model for the view. I get missing namespace error.
In Applic开发者_StackOverflow社区ation_start() I have:
var assembly = Assembly.LoadFrom(dll.FullName);
//different from Mika's
container.Register(AllTypes.FromAssembly(assembly)
.Where(t => t.Name.EndsWith("Model")));
and Settings.cshtml file invoking the error:
@{
Layout = ";~/Views/Shared/_Layout.cshtml";
var viewModel = Model as Crash.PageRating.SettingsViewModel; //error missing namespace Crash.PageRating
}
Mika says that @model does not work for him either.
Here is my solution
Thanks for help!
精彩评论