Friday, February 25, 2011

FubuMVC - IOC Container

Another niceties of FubuMVC is that it has its own IOC in its heart. Right now just StructureMap is supported but it's been said that other well-known IOC containers might be supported in future (Castle windsor, Autofac,.. even Unity!!)

Look how easy it is to bootstrap IOC in application's startup evet:
 
// ConfigureFubuMVC is explained in the last post



And NhibernateRegsitry class contains all information for our interfaces.
    public class NHibernateRegistry : Registry
    {
        public NHibernateRegistry()
        {
            ForSingletonOf().Use();
            For().HybridHttpOrThreadLocalScoped().Use();
            ....
            .......
        }
    }


Friday, February 18, 2011

FubuMVC - Startup Conventions

FubuMVC is working based on conventions. Although some conventions are set as default in the heart of framework, you as a developer may want to extend or install a brand new convention. That makes programming very easy and efficient. There is no need to tell the code which controllers' method should be execute on and on.

Look how we can configure the fubu :



In the first lines, I tell the framework that configuration only applies to MyProject.dll and MyProject.Data.dll.
Then all classes that ends with action are my controllers. (with mvc literature). 
Then ignore all namespaces for action classes also ignore certain suffixes, for example, if an action class is deep in the project like (MyProject.UI.Actions.Exchange.AddExchangeAction), for routing just call AddExchange.

All Views that are using the model on their back, should have the same name as their models.
This stuff is set when the application starts and no needs to reconfigure for each situation.