ViewComponent not found after updating Monorail from version 1.0.3 to v2.1RC

I am using Monorail in my C # web application. Since I updated it (.NET Framework 2-4 and Monorail 1.0.3 to 2.1RC), my ViewComponent class was not found. All of my controllers seem to be working fine. I am using the nVelocity View Engine. I do not use Windsor, but maybe now I have to register it in a certain way?

In the .vm file, I experimented in the following lines (without success, the first worked before I updated the project):

 #component(MenuComponent)
 #component(MenuComponent with "role=admins")
 #blockcomponent(MenuComponent with "role=admins")

Has anyone experimented?

Full error message:

ViewComponent 'MenuComponent' may not be found. Was it registered? If you enabled Windsor integration, then you probably forgot to register the view component as the Windsor component. If you are sure that you did this, then make sure that the name used is the identifier of the component or the key passed to ViewComponentDetailsAttribute

Many thanks!

+3
source share
2 answers

- . "Castle.Monorail.Framework.dll", , : , , Web.Config( <Controllers> <viewcomponents>), , , , , .

dll, . "" , , - (, ).

"", . : http://www.symbolsource.org/Public/Metadata/Default/Project/Castle/1.0-RC3/Debug/All/Castle.MonoRail.Framework/Castle.MonoRail.Framework/Services/DefaultViewComponentFactory.cs

*Assembly:* Castle.MonoRail.Framework
*Class:* Castle.MonoRail.Framework.Services.**DefaultViewComponentFactory**


public override void Service(IServiceProvider provider)
{
  /* Here is the section I moved */
  var config = (IMonoRailConfiguration)provider.GetService(typeof(IMonoRailConfiguration));
  if (config != null)
  {
    assemblies = config.ViewComponentsConfig.Assemblies;
    if (assemblies == null || assemblies.Length == 0)
    {
      // Convention: uses the controller assemblies in this case
      assemblies = config.ControllersConfig.Assemblies.ToArray();
    }
  }
  /*******************************/

  base.Service(provider); // Assemblies inspection is done there

  var loggerFactory = (ILoggerFactory) provider.GetService(typeof(ILoggerFactory));
  if (loggerFactory != null)
  {
    logger = loggerFactory.Create(typeof(DefaultViewComponentFactory));
  }
  /* The moved section was here */
}
+1

, , MenuComponent , ?

0

All Articles