Exemplo n.º 1
0
        private void RegisterIoC(Funq.Container container)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["SourceMiner"].ConnectionString;

              container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider));

              container.RegisterAs<OrmLiteChangesetQuery, IChangesetQuery>();

              container.Register<ICacheClient>(new MemoryCacheClient());
        }
Exemplo n.º 2
0
        private void RegisterIoC(Funq.Container container)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["SourceMiner"].ConnectionString;

              container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider));

              container.RegisterAs<OrmLiteChangesetQuery, IChangesetQuery>();

              var nuGetPackageFeed = ConfigurationManager.AppSettings["NugetPackageFeedUrl"];

              container.Register<INugetFeedClient>(c => new NugetFeedClient(PackageRepositoryFactory.Default.CreateRepository(nuGetPackageFeed)));

              container.Register<ICacheClient>(new MemoryCacheClient());
        }
        private void ConfigureAuth(Funq.Container container, IAppSettings appSettings)
        {
            //Enable and register existing services you want this host to make use of.
            //Look in Web.config for examples on how to configure your oauth providers, e.g. oauth.facebook.AppId, etc.

            //Register all Authentication methods you want to enable for this web app.
            Plugins.Add(new AuthFeature(
                () => new CustomUserSession(), //Use your own typed Custom UserSession type
                new IAuthProvider[] {
                    new CredentialsAuthProvider(),              //HTML Form post of UserName/Password credentials
                    new TwitterAuthProvider(appSettings),       //Sign-in with Twitter
                    new FacebookAuthProvider(appSettings),      //Sign-in with Facebook
                    new DigestAuthProvider(appSettings),        //Sign-in with Digest Auth
                    new BasicAuthProvider(),                    //Sign-in with Basic Auth
                    new YahooOpenIdOAuthProvider(appSettings),  //Sign-in with Yahoo OpenId
                    new OpenIdOAuthProvider(appSettings),       //Sign-in with Custom OpenId
                }));

            //Provide service for new users to register so they can login with supplied credentials.
            Plugins.Add(new RegistrationFeature());

            //override the default registration validation with your own custom implementation
            container.RegisterAs<CustomRegistrationValidator, IValidator<Register>>();

            //Create a DB Factory configured to access the UserAuth PostgreSQL DB
            var connStr = appSettings.GetString("ConnectionString");
            container.Register<IDbConnectionFactory>(
                new OrmLiteConnectionFactory(connStr, //ConnectionString in Web.Config
                    PostgreSqlDialect.Provider) {
                        ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current)
                    });

            //Store User Data into the referenced SqlServer database
            container.Register<IUserAuthRepository>(c =>
                new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())); //Use OrmLite DB Connection to persist the UserAuth and AuthProvider info

            var authRepo = (OrmLiteAuthRepository)container.Resolve<IUserAuthRepository>(); //If using and RDBMS to persist UserAuth, we must create required tables
            if (appSettings.Get("RecreateAuthTables", false))
                authRepo.DropAndReCreateTables(); //Drop and re-create all Auth and registration tables
            else
                authRepo.InitSchema();   //Create only the missing tables

            Plugins.Add(new RequestLogsFeature());
        }
Exemplo n.º 4
0
        // Uncomment to enable ServiceStack Authentication and CustomUserSession
        private void ConfigureAuth(Funq.Container container)
        {
            var appSettings = new AppSettings();

            //Default route: /auth/{provider}
            Plugins.Add(new AuthFeature(() => new CustomUserSession(), //Use your own typed Custom UserSession type
                new IAuthProvider[] {
                    //new CredentialsAuthProvider(appSettings),
                    new CustomCredentialsAuthProvider(appSettings),
                    new FacebookAuthProvider(appSettings),
                    //new TwitterAuthProvider(appSettings),
                    new BasicAuthProvider(appSettings),
                }));

            //Default route: /register
            Plugins.Add(new RegistrationFeature());

            //override the default registration validation with your own custom implementation
            container.RegisterAs<CustomRegistrationValidator, IValidator<Registration>>();

            ////Requires ConnectionString configured in Web.Config
            //var connectionString = ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString;
            //container.Register<IDbConnectionFactory>(c =>
            //    new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider));

            container.Register<IUserAuthRepository>(c =>
                new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));

            var authRepo = (OrmLiteAuthRepository)container.Resolve<IUserAuthRepository>();
            authRepo.ValidUserNameRegEx = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
            authRepo.CreateMissingTables();
        }
Exemplo n.º 5
0
        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            //Configure User Defined REST Paths
            //Routes
            //    .Add<Hello>("/hello")
            //    .Add<Hello>("/hello/{Name*}")
            //    .Add<Todo>("/todos")
            //    .Add<Todo>("/todos/{Id}");
            //.Add<NearByAdventureLocations>("/adventure/locations/{LatLon}");

            //Uncomment to change the default ServiceStack configuration
            //SetConfig(new EndpointHostConfig {
            //    DebugMode = true, //Show StackTraces when developing
            //});

            //Enable Authentication
            //ConfigureAuth(container);

            //Register all your dependencies
            //container.Register(new TodoRepository());

            // Add our mongo adventure type repo into the system
            container.Register(new MongoAdventureTypeRepository());

            var adventureLocationSearchRepository = new ElasticAdventureLocationSearchRepository
                                                        {ElasticServer = Settings.ElasticLocationServer};

            container.Register(adventureLocationSearchRepository);

            // Register our mongo adapter as the IAdventuretypeRepository to use :D
            container.RegisterAs<MongoAdventureTypeRepository, IAdventureReviewRepository>();
            container.RegisterAs<MongoAdventureTypeRepository, IAdventureTypeRepository>();
            container.RegisterAs<MongoAdventureTypeRepository, IAdventureTypeTemplateRepository>();
            container.RegisterAs<MongoAdventureTypeRepository, IAdventureRegionRepository>();
            container.RegisterAs<MongoAdventureTypeRepository, IAdventureLocationRepository>();

            container.RegisterAs<ElasticAdventureLocationSearchRepository, IAdventureLocationSearchRepository>();
        }
Exemplo n.º 6
0
            public override void Configure(Funq.Container container)
            {
                //Set JSON web services to return idiomatic JSON camelCase properties
                ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;
                var appSettings = new AppSettings();
                //Registers authorization service and endpoints /auth and /auth{provider}

                Plugins.Add(new AuthFeature(() => new AuthUserSession(),
                    new IAuthProvider[] {
                    new CredentialsAuthProvider(),              //HTML Form post of UserName/Password credentials
                    new TwitterAuthProvider(appSettings),       //Sign-in with Twitter
                    //new FacebookAuthProvider(appSettings),      //Sign-in with Facebook
                    new GoogleOpenIdOAuthProvider(appSettings), //Sign-in with Google OpenId
                }) {HtmlRedirect = "/Camper/SignIn"});

                //Provide service for new users to register so they can login with supplied credentials.
                Plugins.Add(new RegistrationFeature());

                NHibernateConfigurator.Initialize<CamperMapping>();
                //Store User Data into the referenced SqlServer database
                container.Register<IUserAuthRepository>(c =>
                    new NHibernateUserAuthRepository()); //Can Use OrmLite DB Connection to persist the UserAuth and AuthProvider info

                //override the default registration validation with your own custom implementation
                container.RegisterAs<MyRegistrationValidator, IValidator<Registration>>();

                var redisCon = ConfigurationManager.AppSettings["redisUrl"].ToString();
                container.Register<IRedisClientsManager>(new PooledRedisClientManager(20, 60, redisCon));
                container.Register<ICacheClient>(c => (ICacheClient)c.Resolve<IRedisClientsManager>().GetCacheClient());

                ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            }
        public override void Configure(Funq.Container container)
        {
            JsConfig.EmitCamelCaseNames = true;
            JsConfig.IncludeNullValues = true;
            JsConfig.DateHandler = JsonDateHandler.ISO8601;

            LogManager.LogFactory = new DebugLogFactory();

            SetConfig(new EndpointHostConfig
            {
                WsdlServiceNamespace = "",
                AllowJsonpRequests = true,
                DebugMode = true,
                EnableFeatures = Feature.All.Remove(GetDisabledFeatures())
            });

            //Authentication (see: https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/AuthTests.cs)
            Plugins.Add(new AuthFeature(() => new AuthUserSession(),
                new IAuthProvider[] {
                  new BasicAuthProvider(), //Sign-in with Basic Auth
                }) { HtmlRedirect = null /* prevent redirect to login page, make the user login using basic auth prompt */ });
            userRepository = new InMemoryAuthRepository();
            container.Register<IUserAuthRepository>(userRepository);
            CreateUser(userRepository, 1, UserName, "DisplayName", null, Password);

            //NEW: Enable the validation feature and scans the service assembly for validators
            Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof(Northwind.Data.Services.CategoryService).Assembly);

            //Caching
            container.Register<ICacheClient>(new MemoryCacheClient());

            //Repositories
            container.RegisterAs<CategoryServiceRepository, ICategoryServiceRepository>();
            container.RegisterAs<CustomerServiceRepository, ICustomerServiceRepository>();
            container.RegisterAs<CustomerCustomerDemoServiceRepository, ICustomerCustomerDemoServiceRepository>();
            container.RegisterAs<CustomerDemographicServiceRepository, ICustomerDemographicServiceRepository>();
            container.RegisterAs<EmployeeServiceRepository, IEmployeeServiceRepository>();
            container.RegisterAs<EmployeeTerritoryServiceRepository, IEmployeeTerritoryServiceRepository>();
            container.RegisterAs<OrderServiceRepository, IOrderServiceRepository>();
            container.RegisterAs<OrderDetailServiceRepository, IOrderDetailServiceRepository>();
            container.RegisterAs<ProductServiceRepository, IProductServiceRepository>();
            container.RegisterAs<RegionServiceRepository, IRegionServiceRepository>();
            container.RegisterAs<ShipperServiceRepository, IShipperServiceRepository>();
            container.RegisterAs<SupplierServiceRepository, ISupplierServiceRepository>();
            container.RegisterAs<TerritoryServiceRepository, ITerritoryServiceRepository>();

            //DataAccess / OrmLite
            var connectionString = ConfigurationManager.ConnectionStrings["ApiDbConnectionString"].ConnectionString;
            container.Register<IDataAccessAdapterFactory>(c => new DataAccessAdapterFactory(connectionString));
            container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, true, new SqlServerOrmLiteDialectProvider()));
        }
        public override void Configure(Funq.Container container)
        {
            JsConfig.EmitCamelCaseNames = true;
            JsConfig.IncludeNullValues = true;
            JsConfig.DateHandler = JsonDateHandler.ISO8601;

            LogManager.LogFactory = new ConsoleLogFactory();

            SetConfig(new EndpointHostConfig
                {
                    WsdlServiceNamespace = "",
                    AllowJsonpRequests = true,
                    DebugMode = true,
                    EnableFeatures = Feature.All.Remove(GetDisabledFeatures()),
                    CustomHttpHandlers = {
                        // Use the CmsRazorHandler to add theming capabilities
                        { HttpStatusCode.NotFound, new CmsRazorHandler("/notfound") }
                    }
                });

            //Authentication (see: https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/AuthTests.cs)
            Plugins.Add(new AuthFeature(() => new AuthUserSession(),
                new IAuthProvider[] {
                  new BasicAuthProvider(), //Sign-in with Basic Auth
                }){ HtmlRedirect = null /* prevent redirect to login page, make the user login using basic auth prompt */ });
            userRepository = new InMemoryAuthRepository();
            container.Register<IUserAuthRepository>(userRepository);
            CreateUser(userRepository, 1, UserName, "DisplayName", null, Password);

            //Enable the validation feature and scan the service assembly for validators
            Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof(Services.CategoryService).Assembly);

            //Razor (use CmsRazorFormat to add theming capabilities)
            Plugins.Add(new CmsRazorFormat());

            //Caching
            container.Register<ICacheClient>(new MemoryCacheClient());

            //Entity Repositories
            container.RegisterAs<CategoryServiceRepository, ICategoryServiceRepository>();
            container.RegisterAs<CustomerServiceRepository, ICustomerServiceRepository>();
            container.RegisterAs<CustomerCustomerDemoServiceRepository, ICustomerCustomerDemoServiceRepository>();
            container.RegisterAs<CustomerDemographicServiceRepository, ICustomerDemographicServiceRepository>();
            container.RegisterAs<EmployeeServiceRepository, IEmployeeServiceRepository>();
            container.RegisterAs<EmployeeTerritoryServiceRepository, IEmployeeTerritoryServiceRepository>();
            container.RegisterAs<OrderServiceRepository, IOrderServiceRepository>();
            container.RegisterAs<OrderDetailServiceRepository, IOrderDetailServiceRepository>();
            container.RegisterAs<ProductServiceRepository, IProductServiceRepository>();
            container.RegisterAs<RegionServiceRepository, IRegionServiceRepository>();
            container.RegisterAs<ShipperServiceRepository, IShipperServiceRepository>();
            container.RegisterAs<SupplierServiceRepository, ISupplierServiceRepository>();
            container.RegisterAs<TerritoryServiceRepository, ITerritoryServiceRepository>();

            //TypedList Repositories
            container.RegisterAs<TLSR.EmployeesByRegionAndTerritoryTypedListServiceRepository, TLSI.IEmployeesByRegionAndTerritoryTypedListServiceRepository>();

            //TypedView Repositories
            container.RegisterAs<TVSR.AlphabeticalListOfProductsTypedViewServiceRepository, TVSI.IAlphabeticalListOfProductsTypedViewServiceRepository>();
            container.RegisterAs<TVSR.CategorySalesFor1997TypedViewServiceRepository, TVSI.ICategorySalesFor1997TypedViewServiceRepository>();
            container.RegisterAs<TVSR.CurrentProductListTypedViewServiceRepository, TVSI.ICurrentProductListTypedViewServiceRepository>();
            container.RegisterAs<TVSR.CustomerAndSuppliersByCityTypedViewServiceRepository, TVSI.ICustomerAndSuppliersByCityTypedViewServiceRepository>();
            container.RegisterAs<TVSR.InvoicesTypedViewServiceRepository, TVSI.IInvoicesTypedViewServiceRepository>();
            container.RegisterAs<TVSR.OrderDetailsExtendedTypedViewServiceRepository, TVSI.IOrderDetailsExtendedTypedViewServiceRepository>();
            container.RegisterAs<TVSR.OrdersQryTypedViewServiceRepository, TVSI.IOrdersQryTypedViewServiceRepository>();
            container.RegisterAs<TVSR.OrderSubtotalTypedViewServiceRepository, TVSI.IOrderSubtotalTypedViewServiceRepository>();
            container.RegisterAs<TVSR.ProductsAboveAveragePriceTypedViewServiceRepository, TVSI.IProductsAboveAveragePriceTypedViewServiceRepository>();
            container.RegisterAs<TVSR.ProductSalesFor1997TypedViewServiceRepository, TVSI.IProductSalesFor1997TypedViewServiceRepository>();
            container.RegisterAs<TVSR.ProductsByCategoryTypedViewServiceRepository, TVSI.IProductsByCategoryTypedViewServiceRepository>();
            container.RegisterAs<TVSR.QuarterlyOrderTypedViewServiceRepository, TVSI.IQuarterlyOrderTypedViewServiceRepository>();
            container.RegisterAs<TVSR.SalesByCategoryTypedViewServiceRepository, TVSI.ISalesByCategoryTypedViewServiceRepository>();
            container.RegisterAs<TVSR.SalesTotalsByAmountTypedViewServiceRepository, TVSI.ISalesTotalsByAmountTypedViewServiceRepository>();
            container.RegisterAs<TVSR.SummaryOfSalesByQuarterTypedViewServiceRepository, TVSI.ISummaryOfSalesByQuarterTypedViewServiceRepository>();
            container.RegisterAs<TVSR.SummaryOfSalesByYearTypedViewServiceRepository, TVSI.ISummaryOfSalesByYearTypedViewServiceRepository>();

            //DataAccess / OrmLite
            var connectionString = ConfigurationManager.ConnectionStrings["ApiDbConnectionString"].ConnectionString;
            container.Register<IDataAccessAdapterFactory>(c => new DataAccessAdapterFactory(connectionString));
            container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, true, new SqlServerOrmLiteDialectProvider()));

            //DataAccess Caching (only for LLBLGen V4)
            //CacheController.RegisterCache(string.Empty /* connectionString */, new ResultsetCache(5*60 /* will purge the cache every 5 minutes */));
        }
Exemplo n.º 9
0
        private void ConfigureAuth(Funq.Container container)
        {
            //Enable and register existing services you want this host to make use of.
            //Look in Web.config for examples on how to configure your oauth proviers, e.g. oauth.facebook.AppId, etc.
            var appSettings = new AppSettings();

            //Register all Authentication methods you want to enable for this web app.
            Plugins.Add(new AuthFeature(
                () => new CustomUserSession(), //Use your own typed Custom UserSession type
                new IAuthProvider[] {
                    new CredentialsAuthProvider(),         //HTML Form post of UserName/Password credentials
                    new TwitterAuthProvider(appSettings),  //Sign-in with Twitter
                    new FacebookAuthProvider(appSettings), //Sign-in with Facebook
                    new BasicAuthProvider(),               //Sign-in with Basic Auth
                }));

            //Provide service for new users to register so they can login with supplied credentials.
            Plugins.Add(new RegistrationFeature());

            //override the default registration validation with your own custom implementation
            container.RegisterAs<CustomRegistrationValidator, IValidator<Registration>>();

            //Create a DB Factory configured to access the UserAuth SQL Server DB
            //var connStr = appSettings.Get("SQLSERVER_CONNECTION_STRING", //AppHarbor or Local connection string
            //    ConfigUtils.GetConnectionString("UserAuth"));
            //container.Register<IDbConnectionFactory>(
            //    new OrmLiteConnectionFactory(connStr, //ConnectionString in Web.Config
            //        SqlServerOrmLiteDialectProvider.Instance) {
            //            ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current)
            //        });

            var mongoDatabase = CreateMongodatabase("hta", new MongoServerSettings() { Server = new MongoServerAddress("localhost") });
            container.Register(mongoDatabase);

            //Store User Data into the referenced SqlServer database
            var authRepository = new MongoDBAuthRepository(mongoDatabase);
            container.Register<IUserAuthRepository>(authRepository); //Use OrmLite DB Connection to persist the UserAuth and AuthProvider info

            if (appSettings.Get("RecreateAuthTables", false))
                authRepository.DropAndReCreateTables(); //Drop and re-create all Auth and registration tables
            else
                authRepository.CreateMissingTables();   //Create only the missing tables

            Plugins.Add(new RequestLogsFeature());
        }
Exemplo n.º 10
0
        private void ConfigureAuth(Funq.Container container)
        {
            //Enable and register existing services you want this host to make use of.
            //Look in Web.config for examples on how to configure your oauth providers, e.g. oauth.facebook.AppId, etc.
            var appSettings = new AppSettings();

            //Register all Authentication methods you want to enable for this web app.
            Plugins.Add(new AuthFeature(
                () => new CustomUserSession(), //Use your own typed Custom UserSession type
                new IAuthProvider[] {
                    new CredentialsAuthProvider(),              //HTML Form post of UserName/Password credentials
                    new TwitterAuthProvider(appSettings),       //Sign-in with Twitter
                    new FacebookAuthProvider(appSettings),      //Sign-in with Facebook
                    new DigestAuthProvider(appSettings),        //Sign-in with Digest Auth
                    new BasicAuthProvider(),                    //Sign-in with Basic Auth
                    new GoogleOpenIdOAuthProvider(appSettings), //Sign-in with Google OpenId
                    new YahooOpenIdOAuthProvider(appSettings),  //Sign-in with Yahoo OpenId
                    new OpenIdOAuthProvider(appSettings),       //Sign-in with Custom OpenId
                }));

            //Provide service for new users to register so they can login with supplied credentials.
            Plugins.Add(new RegistrationFeature());

            //override the default registration validation with your own custom implementation
            container.RegisterAs<CustomRegistrationValidator, IValidator<Registration>>();

            //Create a DB Factory configured to access the UserAuth SQL Server DB
            var connStr = appSettings.Get("SQLSERVER_CONNECTION_STRING", //AppHarbor or Local connection string
                ConfigUtils.GetConnectionString("UserAuth"));
            container.Register<IDbConnectionFactory>(
                new OrmLiteConnectionFactory(connStr, //ConnectionString in Web.Config
                    SqlServerOrmLiteDialectProvider.Instance) {
                        ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current)
                    });

            //Store User Data into the referenced SqlServer database
            container.Register<IUserAuthRepository>(c =>
                new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())); //Use OrmLite DB Connection to persist the UserAuth and AuthProvider info

            var authRepo = (OrmLiteAuthRepository)container.Resolve<IUserAuthRepository>(); //If using and RDBMS to persist UserAuth, we must create required tables
            if (appSettings.Get("RecreateAuthTables", false))
                authRepo.DropAndReCreateTables(); //Drop and re-create all Auth and registration tables
            else
                authRepo.CreateMissingTables();   //Create only the missing tables

            //container.Register<ICacheClient>(new NullCacheClient());
            container.Register<ICacheClient>(new MongoCacheClient.CacheClient(ConfigUtils.GetConnectionString("Cache"), "robertbird"));

            Plugins.Add(new RequestLogsFeature() {
                EnableResponseTracking = true,
                EnableErrorTracking = true,
                EnableSessionTracking = true,
                RequiredRoles = new string[] { } });
        }
Exemplo n.º 11
0
        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            //Configure User Defined REST Paths
            Routes
                .Add<Sms>("/sms")
                .Add<Schedule>("/schedule")
                .Add<Coordinator>("/coordinator");

            //Change the default ServiceStack configuration
            //SetConfig(new EndpointHostConfig {
            //    DebugMode = true, //Show StackTraces in responses in development
            //});

            //Enable Authentication
            //ConfigureAuth(container);

            //Register all your dependencies
            //container.Register(new TodoRepository());

            //Register In-Memory Cache provider.
            //For Distributed Cache Providers Use: PooledRedisClientManager, BasicRedisClientManager or see: https://github.com/ServiceStack/ServiceStack/wiki/Caching
            container.Register<ICacheClient>(new MemoryCacheClient());
            container.Register<ISessionFactory>(c =>
                new SessionFactory(c.Resolve<ICacheClient>()));

            container.RegisterAs<RavenDocStore, IRavenDocStore>();// .Register<IRavenDocStore>(new RavenDocStore());
            container.RegisterAs<DateTimeUtcFromOlsenMapping, IDateTimeUtcFromOlsenMapping>();
            container.RegisterAs<CoordinatorModelToMessageMapping, ICoordinatorModelToMessageMapping>();//new CoordinatorModelToMessageMapping(new DateTimeUtcFromOlsenMapping()));
            container.RegisterAs<CoordinatorApiModelToMessageMapping, ICoordinatorApiModelToMessageMapping>(); // (new CoordinatorApiModelToMessageMapping());

            var busConfig = NServiceBus.Configure.With()
                .DefineEndpointName("SmsWeb")
                .DefaultBuilder()
                    .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith("Commands"))
                    .DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith("Events"))
                    .DefiningMessagesAs(t => t.Namespace == "SmsMessages")
                    .Log4Net()
                .XmlSerializer()
                .MsmqTransport()
                    .IsTransactional(true)
                    .PurgeOnStartup(false)
                .UnicastBus()
                    .LoadMessageHandlers();
            NServiceBus.Configure.Instance.Configurer.ConfigureComponent<RavenDocStore>(DependencyLifecycle.SingleInstance);
            NServiceBus.Configure.Instance.Configurer.ConfigureComponent<SmsScheduleStatusHandler>(DependencyLifecycle.InstancePerCall);
                    //.LoadMessageHandlers<SmsScheduleStatusHandler>();

            //busConfig.Configurer.ConfigureComponent<DateTimeUtcFromOlsenMapping>(DependencyLifecycle.SingleInstance);

            var bus = busConfig.CreateBus().Start();//() => NServiceBus.Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());

            //container.Register(new SmsScheduleStatusHandler(new RavenDocStore()));
            container.Register(bus);
            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
        }