private void WireUpIoC()
        {
            //This is the bootstrap for the castle Highway.Data implementation. 
            //You IoC implementation will have a similar class, just change the namespace and
            //let intellisense be your guide
            var bootstrap = new Highway.Data.EntityFramework.Castle.CastleBootstrap();

            var container = new WindsorContainer();
            bootstrap.Install(container, null);

            //Wiring in our types
            container.Register(
                //This is Highway.Data's Context
                Component.For<IDataContext>().ImplementedBy<DataContext>()
                .DependsOn(Dependency.OnConfigValue("connectionString", Settings.Default.ConnectionString)),
                //This is Highway.Data's Repository
                Component.For<IRepository>().ImplementedBy<Repository>(),
                //This is Highway.Data's relational mappings Interface, but YOUR implementation
                Component.For<IMappingConfiguration>().ImplementedBy<GettingStartedMappings>(),
                //This is Common.Loggings log interface, feel free to supply anything that uses it *cough* log4net
                Component.For<ILog>().ImplementedBy<NoOpLogger>(),
                //This is Highway.Data's context configuration, by default use the default :-)
                Component.For<IContextConfiguration>().ImplementedBy<DefaultContextConfiguration>());
            

            //TODO: Wire up your types here

            ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
        }
Exemple #2
0
        private void WireUpIoC()
        {
            //This is the bootstrap for the castle Highway.Data implementation.
            //You IoC implementation will have a similar class, just change the namespace and
            //let intellisense be your guide
            var bootstrap = new Highway.Data.EntityFramework.Castle.CastleBootstrap();

            var container = new WindsorContainer();

            bootstrap.Install(container, null);

            //Wiring in our types
            container.Register(
                //This is Highway.Data's Context
                Component.For <IDataContext>().ImplementedBy <DataContext>()
                .DependsOn(Dependency.OnConfigValue("connectionString", Settings.Default.ConnectionString)),
                //This is Highway.Data's Repository
                Component.For <IRepository>().ImplementedBy <Repository>(),
                //This is Highway.Data's relational mappings Interface, but YOUR implementation
                Component.For <IMappingConfiguration>().ImplementedBy <GettingStartedMappings>(),
                //This is Common.Loggings log interface, feel free to supply anything that uses it *cough* log4net
                Component.For <ILog>().ImplementedBy <NoOpLogger>(),
                //This is Highway.Data's context configuration, by default use the default :-)
                Component.For <IContextConfiguration>().ImplementedBy <DefaultContextConfiguration>());


            //TODO: Wire up your types here

            ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
        }