title: how to register all classes in assembly with Castle Windsor in MVC 3
body: <p>I'm starting with ASP.NET MVC 3 and modules. </p>
  
  <p>Like the Orchard CMS modules, I want to have modules as assemblies with Razor pages (inside/outside the DLL). I followed <a href="http://mikakolari.fi/2011/02/aspnetmvc-3-plugin-architecture-with-embedded-razor-views/" rel="nofollow">Mika Kolari's tutorial</a>, but I don't know how to include all the classes from the assembly namespace in the core project with Castle Windsor. </p>
  
  <p>I'm able to load Controller from the assembly, but not Model for the view. I get missing namespace error.</p>
  
  <p>In Application_start() I have:</p>
  
  <pre><code>var assembly = Assembly.LoadFrom(dll.FullName);
  //different from Mika's
  container.Register(AllTypes.FromAssembly(assembly)
                             .Where(t =&gt; t.Name.EndsWith("Model")));
  </code></pre>
  
  <p>and Settings.cshtml file invoking the error:</p>
  
  <pre><code>@{
  Layout = ";~/Views/Shared/_Layout.cshtml";
  var viewModel = Model as Crash.PageRating.SettingsViewModel; //error missing namespace Crash.PageRating
  }
  </code></pre>
  
  <p>Mika says that @model does not work for him either.</p>
  
  <p>Here is my <a href="http://dl.dropbox.com/u/9865839/Crash.zip" rel="nofollow">solution</a></p>
  
  <p>Thanks for help!</p>