Log in / create account

FubuMVC wiki
[FubuMVC home]

FubuRegistry

From FubuMVC Wiki

Contents

Introduction

The key to configuring FubuMVC is the FubuRegistry. Create a class that derives from FubuMVC.Core.FubuRegistry, and configure it by calling methods in the constructor. This page describes the different options that are available.

The FubuRegistry DSL is still under construction. We will attempt to keep this page up to date, but there is a good chance that some of the properties/methods mentioned on this page may have changed.

Actions

The first step toward configuring FubuMVC is telling it how to wire up the Actions in your application. This process consists of:

URL Lookup

UrlRegistry (TODO)

Model Binding

Models (TODO)

Add Behaviors

  • ApplyConvention<TConvention>() (TODO)
  • Policies (TODO)

Other

  • IncludeDiagnostics (TODO)
  • Import (TODO)
  • Services (TODO)
  • HomeIs (TODO)

Example

   public class HelloWorldFubuRegistry : FubuRegistry
   {
       public HelloWorldFubuRegistry()
       {
           IncludeDiagnostics(true);
           Applies.ToThisAssembly();
           Actions
               .IncludeTypesNamed(x => x.EndsWith("Controller"));
           Routes
               .IgnoreControllerNamespaceEntirely()
               .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Command"), "POST")
               .ConstrainToHttpMethod(action => action.Method.Name.StartsWith("Query"), "GET");
           Views
               .TryToAttach(x=>
               {
                   x.to_spark_view_by_action_namespace_and_name(GetType().Namespace);
                   x.by_ViewModel_and_Namespace_and_MethodName();
                   x.by_ViewModel_and_Namespace();
                   x.by_ViewModel();
               });
           HomeIs<HomeInputModel>();
       }
   }

Page Discussion View source History