Beispiel #1
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var container = new Funq.Container();
            Tepeyac.Core.Registry.Register(container);

            container.Register<IFiber>("GuiFiber", c =>
            {
                var executor =
                    c.Resolve<IExecutor>() ??
                    new Executor();
                var fiber = new MonoTouchFiber(executor);
                fiber.Start();

                return fiber;
            });

            container.Register<ILauncher>(c =>
                new Tepeyac.UI.MonoTouch.Launcher());

            var view = new BurritoDayView(container);
            window.AddSubview(view.View);
            window.MakeKeyAndVisible();

            return true;
        }
        public static bool InitSQLServer(this Funq.Container container)
        {
            try
            {
                // Register the Microsoft Sql Server Database Connection Factory
                var sqlServerConnectionString = ConfigurationManager.ConnectionStrings["SQLServer"];
                var sqlServerFactory          = new SqlServerOrmLiteConnectionFactory(sqlServerConnectionString.ConnectionString);
                sqlServerFactory.DialectProvider.UseUnicode = true;
                container.Register <ISqlServerOrmLiteConnectionFactory>(c => sqlServerFactory);

                // Create needed tables in Microsoft Sql Server if they do not exist
                using (var conn = sqlServerFactory.OpenDbConnection())
                {
                    return(conn.CreateWorldTable() && conn.CreateFortuneTable());
                }
            }
            catch (Exception ex)
            {
                // Unregister failed database connection factory
                container.Register <ISqlServerOrmLiteConnectionFactory>(c => null);

                return(false);
            }
        }
        public static bool InitPostgreSQL(this Funq.Container container)
        {
            try
            {
                // Register the PostgreSQL Database Connection Factory
                var postgreSqlConnectionString = ConfigurationManager.ConnectionStrings["PostgreSQL"];
                var postgreSqlFactory          = new PostgreSqlOrmLiteConnectionFactory(postgreSqlConnectionString.ConnectionString);
                postgreSqlFactory.DialectProvider.UseUnicode = true;
                container.Register <IPostgreSqlOrmLiteConnectionFactory>(c => postgreSqlFactory);

                // Create needed tables in PostgreSql Server if they do not exist
                using (var conn = postgreSqlFactory.OpenDbConnection())
                {
                    return(conn.CreateWorldTable() && conn.CreateFortuneTable());
                }
            }
            catch (Exception ex)
            {
                // Unregister failed database connection factory
                container.Register <IPostgreSqlOrmLiteConnectionFactory>(c => null);

                return(false);
            }
        }
        public static Funq.Container Build(Funq.Container container)
        {
            container.Register <HostContext>(c => HostContext.Instance).ReusedWithin(Funq.ReuseScope.Request);
            //container.Register<IServiceProxy>(Proxy, new ServiceProxy());

            //container.Register<string>(Constants.NamedString, c =>
            //{
            //    var serviceProxy = c.ResolveNamed<IServiceProxy>(Proxy);
            //    return serviceProxy.ContractNumber;
            //    //return "";
            //}).ReusedWithin(Funq.ReuseScope.Request);

            container = MedicationContainer.Configure(container);

            return(container);
        }
Beispiel #5
0
 static void RegisterStorageFactory(Funq.Container container, bool use_encryption)
 {
     container.Register <DbStorageFactory> (c => {
         var conn_factory = c.Resolve <IDbConnectionFactory> ();
         DbStorageFactory storage_factory;
         if (use_encryption)
         {
             storage_factory = new DbStorageFactory(conn_factory, use_encryption: true, use_history: true);
         }
         else
         {
             storage_factory = new DbStorageFactory(conn_factory, use_encryption: false, use_history: true);
         }
         return(storage_factory);
     });
 }
Beispiel #6
0
            public override void Configure(Funq.Container container)
            {
                SetConfig(new HostConfig {
                    DebugMode = true
                });

                Plugins.Add(new RazorFormat());
                var x = "Server=PC-2350;Database=test;Trusted_Connection=True;MultipleActiveResultSets=true";

                container.Register <IDbConnectionFactory>(
                    c =>
                {
                    OrmLiteConnectionFactory dbFactory = new OrmLiteConnectionFactory(x, SqlServerDialect.Provider);
                    dbFactory.RegisterConnection("DefaultConnection", dbFactory);
                    return(dbFactory);
                });
            }
Beispiel #7
0
        public override void Configure(Funq.Container container)
        {
            SetConfig(new EndpointHostConfig
            {
                DebugMode = false,

                GlobalResponseHeaders =
                {
                    { "Access-Control-Allow-Origin",  "*"                               },
                    { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" }
                },

                EnableFeatures = ServiceStack.ServiceHost.Feature.All,

                ServiceStackHandlerFactoryPath = "api"
            });

            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            var appSettings = new AppSettings();

            AppConfig = new AppConfig(appSettings);

            container.Register(AppConfig);

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

            AdzCredenticalsProvider authProvider = new AdzCredenticalsProvider();

            Plugins.Add(new SessionFeature());

            AuthFeature authFeature = new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                authProvider, new BasicAuthProvider()
            });

            Plugins.Add(authFeature);

            //Plugins.Add(new RegistrationFeature());

            dbFactory = GetDbConnectionFromConfig();
            container.Register <IDbConnectionFactory>(dbFactory);
            DatabaseConnection = dbFactory.OpenDbConnection();
            container.Register(c => dbFactory.OpenDbConnection()).ReusedWithin(Funq.ReuseScope.Container);

            Helper.Common.ORMCreateTableOnInit(DatabaseConnection, "admin");

            var userRep = new ABORMLiteAuthRepository(dbFactory);

            container.Register <IAuthProvider>(authProvider);

            container.Register <IUserAuthRepository>(userRep);
        }
Beispiel #8
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*}");

            //Uncomment to change the default ServiceStack configuration
            //SetConfig(new EndpointHostConfig {
            //});

            //Enable Authentication
            //ConfigureAuth(container);

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

            // clear
            this.Plugins.RemoveAll(x => x is CsvFormat);
            //SetConfig(new EndpointHostConfig
            //{
            //    EnableFeatures = Feature.All.Remove(Feature.Csv),
            //});

            // install custom CSV
            Plugins.Add(new CsvFilenameFormat());
            //Plugins.Add(new CsvFormat());

            // not working
            //this.ContentTypeFilters.Register(ContentType.Csv, null, CsvSerializer.DeserializeFromStream);
            //this.ResponseFilters.Add((req, res, dto) =>
            //{
            //    if (req.ResponseContentType == ContentType.Csv)
            //    {
            //        res.AddHeader(HttpHeaders.ContentDisposition,
            //            string.Format("attachment;filename={0}.csv", "bogus"));
            //    }
            //});
        }
Beispiel #9
0
        public override void Configure(Funq.Container container)
        {
            //Register all your dependencies
            container.Register(new TodoRepository());

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

            //Uncomment to change the default ServiceStack configuration
            //var disableFeatures = Feature.Jsv | Feature.Soap;
            //SetConfig(new EndpointHostConfig
            //{
            //    EnableFeatures = Feature.All.Remove(disableFeatures),
            //    DebugMode = true, //Show StackTraces when developing
            //});
        }
Beispiel #10
0
        public override void Configure(Funq.Container container)
        {
            // Add credentials provider and our custom session
            Plugins.Add(new AuthFeature(() => new MyServiceUserSession(), new IAuthProvider[] { new CredentialsAuthProvider() }));

            // Add registered users to the system
            var userRep = new InMemoryAuthRepository();

            foreach (Model.User user in Db.Users)
            {
                userRep.CreateUserAuth(new UserAuth {
                    Id = user.Id, UserName = user.Username
                }, user.Password);
            }
            container.Register <IUserAuthRepository>(userRep);

            SetConfig(new HostConfig {
                DebugMode = true,
            });
        }
Beispiel #11
0
        protected void ConfigureMessageServiceForLongOperations <T>(Funq.Container container, bool startMessageService = true) where T : LongOperationStartDtoBase
        {
            container.Register <IMessageService>(c => new RedisMqServer(c.Resolve <IRedisClientsManager>()));
            container.Resolve <IMessageService>().RegisterHandler <T>(m =>
            {
                var req = new BasicRequest
                {
                    Verb = HttpMethods.Post
                };

                req.Headers["X-ss-id"] = m.GetBody().SessionId;
                var response           = ExecuteMessage(m, req);
                return(response);
            });

            if (startMessageService)
            {
                container.Resolve <IMessageService>().Start();
            }
        }
Beispiel #12
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*}");

            //Uncomment to change the default ServiceStack configuration
            //SetConfig(new EndpointHostConfig {
            //});

            //Enable Authentication
            //ConfigureAuth(container);

            //Register all your dependencies
            container.Register(new TodoRepository());
        }
Beispiel #13
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*}");

            SetConfig(new EndpointHostConfig {
            });

            Plugins.Add(new SwaggerFeature());

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

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
        }
Beispiel #14
0
        /// <summary>
        /// Configures the authentication.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="factory">The factory.</param>
        public void ConfigureAuth(Funq.Container container, OrmLiteConnectionFactory factory)
        {
            // Instantiate the authentication repository with the configured OrmLiteConnectionFactory.
            var authRepository = new OrmLiteAuthRepository(factory);

            // Create the missing tables if they are not yet configured.
            authRepository.CreateMissingTables();

            // Register the authentication repository.
            container.Register <IUserAuthRepository>(c => authRepository);

            // Register all Authentication methods needed.
            Plugins.Add(
                new AuthFeature(
                    () => new AuthUserSession(),
                    new IAuthProvider[] { new CredentialsAuthProvider(), new BasicAuthProvider() }));

            // HtmlRedirect = null --^

            // Provide service for new users to register so they can login with supplied credentials.
            Plugins.Add(new RegistrationFeature());
        }
Beispiel #15
0
            public override void Configure(Funq.Container container)
            {
                Plugins.Add(new RequestLogsFeature());
                this.Config.DefaultContentType = "Json";
                //container.RegisterAutoWired<InMemoryFileSystem>();

                InMemoryFileSystem fileSystem = new InMemoryFileSystem();

                container.Register <InMemoryFileSystem> (fileSystem);

                Console.WriteLine("Application_Start ---->. Begin");

                //Start the ISIS System
                IsisSystem.Start();

                Console.WriteLine("ISIS Started :)");

                FileServerComm.fileServerGroupName = "FileServer";
                FileServerComm fileSrvComm = FileServerComm.getInstance();

                fileSrvComm.getFileHandler().filesystem = fileSystem;

                System.IO.StreamReader file = new System.IO.StreamReader("bootstrap.txt");
                string line = file.ReadLine();

                Console.WriteLine(line);

                bool isBootStrap = false;

                if (line.Equals("1"))
                {
                    isBootStrap = true;
                }

                fileSrvComm.ApplicationStartup(isBootStrap, FileServerComm.fileServerGroupName);

                Console.WriteLine("Application_Start. End");
            }
Beispiel #16
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<MMYInfo>("/MMYInfo")
            .Add <MMYInfo>("/MMYInfo/{Sku}");

            //Uncomment to change the default ServiceStack configuration
            //SetConfig(new EndpointHostConfig {
            //});

            //Enable Authentication
            //ConfigureAuth(container);

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

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
        }
Beispiel #17
0
        /// <summary>
        /// Configures the application host.
        /// </summary>
        /// <param name="container">The container.</param>
        public override void Configure(Funq.Container container)
        {
            // Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            // Create the connection factory for our database.
            var factory = new OrmLiteConnectionFactory(WebConfigurationManager.ConnectionStrings["SquarePeg"].ConnectionString, MySqlDialect.Provider);

            // Register database.
            container.Register(c => factory.OpenDbConnection());

            // Register logging.
            container.Register <ILog>(c => LogManager.GetLogger(this.GetType()));

            // Register caching dependencies.
            container.Register <IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379"));
            container.Register <ICacheClient>(c =>
                                              (ICacheClient)c.Resolve <IRedisClientsManager>()
                                              .GetCacheClient())
            .ReusedWithin(Funq.ReuseScope.None);

            // Register repositories
            container.Register <IBoardsRepository>(c => new BoardsRepository(container.Resolve <IDbConnection>()));

            // Register services.
            container.Register <IBoardsService>(
                c => new BoardsService(container.Resolve <IBoardsRepository>(), container.Resolve <ICacheClient>()));

            // Configure the authentiation.
            this.ConfigureAuth(container, factory);

            // Set the sharec container; this is used by other shared omponents such as aspects.
            SharedContainer.Container = container;

            // Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
        }
Beispiel #18
0
        public static void DefaultConfig(Funq.Container container)
        {
            var provider = MySqlDialectProvider.Instance;

            container.Register <IDbConnectionFactory>(
                new OrmLiteConnectionFactory(
                    ConfigurationManager.ConnectionStrings["defaultConnection"].ConnectionString, provider)
            {
                ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current)
            });

            container.Register <IUnitOfWorkProvider>(new UnitOfWorkProvider(container.Resolve <IDbConnectionFactory>()));
            container.Register <IConfig>(new ApiConfig(container.Resolve <IDbConnectionFactory>()));

            container.Register <IUserRepo>(new UserRepository(container.Resolve <IUnitOfWorkProvider>()));

            container.Register <IEditModelHerper>(new EditModelHelper(container.Resolve <IUserRepo>()));
            container.Register <IUserService>(new UserService(container.Resolve <IUserRepo>(),
                                                              container.Resolve <IEditModelHerper>()));



            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
        }
Beispiel #19
0
        public override void Configure(Funq.Container container)
        {
            var dbFactory = new OrmLiteConnectionFactory(ConfigurationManager.ConnectionStrings["default"].ConnectionString, MySqlDialect.Provider);

            container.Register <IDbConnectionFactory>(dbFactory);
        }
Beispiel #20
0
 public override void Configure(Funq.Container container)
 {
     container.Register(new TodoRepository());
 }
            public override void Configure(Funq.Container container)
            {
                //Confiture our application

                //IKernel kernel = new StandardKernel();
                //kernel.Bind<TrackedDataRepository>().ToSelf(); //similar to funq, singleton. Class resolved to itself

                //container.Adapter = new NinjectContainerAdapter(kernel);


                //Authentication configuration - iOC container
                Plugins.Add(new AuthFeature(() => new AuthUserSession(),
                                            new IAuthProvider[]
                                            { new BasicAuthProvider(),
                                              new TwitterAuthProvider(new AppSettings()) }));


                Plugins.Add(new RegistrationFeature());                 //registration for new user

                Plugins.Add(new ValidationFeature());
                container.RegisterValidators(typeof(EntryService).Assembly);                //configure validators


                Plugins.Add(new RequestLogsFeature());                 //enable request logs feature, a user with Admin privilages is needed

                Plugins.Add(new RazorFormat());

                container.Register <ICacheClient>(new MemoryCacheClient());                //cache client // can set up Redis/Azure

                //Redis container.Register<IRedisClientManager>(c => new PooledRedisClientManager(redis client path));
                //container.Register<ICacheClient>(c =>(ICacheClient)c.Resolve<IRedisClientManager>().GetCacheClient(); < resolve to cache client Redis' client.

                var userRepository = new InMemoryAuthRepository();                 //in memory auth repository

                container.Register <IUserAuthRepository>(userRepository);

                //add a user
                string hash;
                string salt;

                new SaltedHash().GetHashAndSaltString("password", out hash, out salt);
                userRepository.CreateUserAuth(new UserAuth
                {
                    Id           = 1,
                    DisplayName  = "JoeUser",
                    Email        = "*****@*****.**",
                    UserName     = "******",
                    FirstName    = "Joe",
                    LastName     = "User",
                    PasswordHash = hash,
                    salt         = salt,
                    Roles        = new List <string> {
                        RoleNames.Admin
                    }                                                                // have to have this role in order to call AssignRoles, UnAssignRoles default services
                    //Roles = new List<string> { "User" },//this is Role Authorization
                    //Permissions = new List<string> {"GetStatus"} //this is Permission Authorization
                }, "password");                 //user is created in the repository

                var dbConnectionFactory = new OrmLiteConnectionFactory(HttpContext.Current.Server.MapPath("~/App_Data/data.txtx"),
                                                                       SqlliteDialect.Provider)
                {
                    ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current);                     //enables any calls through ORM to be profiled.
                };


                container.Register <IDbConnectionFactory>(dbConnectionFactory)        //anywhere you want to use dbConnectionFactory, Funq will automatically populate this

                container.RegisterAutoWired <TrackedDataRepository>();                //Autowiring services and auto inject any public properties, SINGLETON by default
                //You can set the scope with ReusedWIthin

                LogManager.LogFactory = new EventLogFactory("ProteinTracker.Logging", "Application");
                //name					//source

                SetConfig(new EndpointHostConfig {
                    DebugMode = true
                });

                container.Register <IRedisClientsManager>(new PooledRedisClientManager("localhost:6379"));               //default redis port
                var mqService = new RedisMqServer(container.Resolve <IRedisClientsManager>());


                mqService.RegisterHandler <Entry>(ServiceController.ExecuteMessage);                //executs the service that handles the Entry message
                //listens for Entry messages

                mqSerice.Start();                 //start listening for messages
            }
Beispiel #22
0
 public static void ConfigureContainer(Funq.Container container)
 {
     #region Characters
     container.Register(c => CharactersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharactersServices>(c => new CharactersServices(c.Resolve <ICharactersBusinessWorkflow>()));
     container.Register(c => CharacterAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterAliasesServices>(c => new CharacterAliasesServices(c.Resolve <ICharacterAliasesBusinessWorkflow>()));
     container.Register(c => CharacterAppearedInIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterAppearedInIssuesServices>(c => new CharacterAppearedInIssuesServices(c.Resolve <ICharacterAppearedInIssuesBusinessWorkflow>()));
     container.Register(c => CharacterCreatorsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterCreatorsServices>(c => new CharacterCreatorsServices(c.Resolve <ICharacterCreatorsBusinessWorkflow>()));
     container.Register(c => CharacterDiedInIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterDiedInIssuesServices>(c => new CharacterDiedInIssuesServices(c.Resolve <ICharacterDiedInIssuesBusinessWorkflow>()));
     container.Register(c => CharacterEnemiesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterEnemiesServices>(c => new CharacterEnemiesServices(c.Resolve <ICharacterEnemiesBusinessWorkflow>()));
     container.Register(c => CharacterEnemyTeamsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterEnemyTeamsServices>(c => new CharacterEnemyTeamsServices(c.Resolve <ICharacterEnemyTeamsBusinessWorkflow>()));
     container.Register(c => CharacterFriendsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterFriendsServices>(c => new CharacterFriendsServices(c.Resolve <ICharacterFriendsBusinessWorkflow>()));
     container.Register(c => CharacterFriendlyTeamsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterFriendlyTeamsServices>(c => new CharacterFriendlyTeamsServices(c.Resolve <ICharacterFriendlyTeamsBusinessWorkflow>()));
     container.Register(c => CharacterIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterIssuesServices>(c => new CharacterIssuesServices(c.Resolve <ICharacterIssuesBusinessWorkflow>()));
     container.Register(c => CharacterMoviesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterMoviesServices>(c => new CharacterMoviesServices(c.Resolve <ICharacterMoviesBusinessWorkflow>()));
     container.Register(c => CharacterPowersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterPowersServices>(c => new CharacterPowersServices(c.Resolve <ICharacterPowersBusinessWorkflow>()));
     container.Register(c => CharacterStoryArcsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterStoryArcsServices>(c => new CharacterStoryArcsServices(c.Resolve <ICharacterStoryArcsBusinessWorkflow>()));
     container.Register(c => CharacterTeamsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterTeamsServices>(c => new CharacterTeamsServices(c.Resolve <ICharacterTeamsBusinessWorkflow>()));
     container.Register(c => CharacterVolumesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICharacterVolumesServices>(c => new CharacterVolumesServices(c.Resolve <ICharacterVolumesBusinessWorkflow>()));
     #endregion
     #region Chats
     container.Register(c => ChatsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IChatsServices>(c => new ChatsServices(c.Resolve <IChatsBusinessWorkflow>()));
     #endregion
     #region Concepts
     container.Register(c => ConceptsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IConceptsServices>(c => new ConceptsServices(c.Resolve <IConceptsBusinessWorkflow>()));
     container.Register(c => ConceptAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IConceptAliasesServices>(c => new ConceptAliasesServices(c.Resolve <IConceptAliasesBusinessWorkflow>()));
     container.Register(c => ConceptAppearedInIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IConceptAppearedInIssuesServices>(c => new ConceptAppearedInIssuesServices(c.Resolve <IConceptAppearedInIssuesBusinessWorkflow>()));
     container.Register(c => ConceptIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IConceptIssuesServices>(c => new ConceptIssuesServices(c.Resolve <IConceptIssuesBusinessWorkflow>()));
     container.Register(c => ConceptMoviesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IConceptMoviesServices>(c => new ConceptMoviesServices(c.Resolve <IConceptMoviesBusinessWorkflow>()));
     container.Register(c => ConceptVolumesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IConceptVolumesServices>(c => new ConceptVolumesServices(c.Resolve <IConceptVolumesBusinessWorkflow>()));
     #endregion
     #region Episodes
     container.Register(c => EpisodesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodesServices>(c => new EpisodesServices(c.Resolve <IEpisodesBusinessWorkflow>()));
     container.Register(c => EpisodeAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeAliasesServices>(c => new EpisodeAliasesServices(c.Resolve <IEpisodeAliasesBusinessWorkflow>()));
     container.Register(c => EpisodeCharactersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeCharactersServices>(c => new EpisodeCharactersServices(c.Resolve <IEpisodeCharactersBusinessWorkflow>()));
     container.Register(c => EpisodeCharactersDiedMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeCharactersDiedServices>(c => new EpisodeCharactersDiedServices(c.Resolve <IEpisodeCharactersDiedBusinessWorkflow>()));
     container.Register(c => EpisodeCharacterFirstAppearancesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeCharacterFirstAppearancesServices>(c => new EpisodeCharacterFirstAppearancesServices(c.Resolve <IEpisodeCharacterFirstAppearancesBusinessWorkflow>()));
     container.Register(c => EpisodeConceptsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeConceptsServices>(c => new EpisodeConceptsServices(c.Resolve <IEpisodeConceptsBusinessWorkflow>()));
     container.Register(c => EpisodeConceptFirstAppearancesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeConceptFirstAppearancesServices>(c => new EpisodeConceptFirstAppearancesServices(c.Resolve <IEpisodeConceptFirstAppearancesBusinessWorkflow>()));
     container.Register(c => EpisodeLocationsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeLocationsServices>(c => new EpisodeLocationsServices(c.Resolve <IEpisodeLocationsBusinessWorkflow>()));
     container.Register(c => EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeLocationFirstAppearancesServices>(c => new EpisodeLocationFirstAppearancesServices(c.Resolve <IEpisodeLocationFirstAppearancesBusinessWorkflow>()));
     container.Register(c => EpisodeObjectsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeObjectsServices>(c => new EpisodeObjectsServices(c.Resolve <IEpisodeObjectsBusinessWorkflow>()));
     container.Register(c => EpisodeObjectFirstAppearancesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeObjectFirstAppearancesServices>(c => new EpisodeObjectFirstAppearancesServices(c.Resolve <IEpisodeObjectFirstAppearancesBusinessWorkflow>()));
     container.Register(c => EpisodePeopleMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodePeopleServices>(c => new EpisodePeopleServices(c.Resolve <IEpisodePeopleBusinessWorkflow>()));
     container.Register(c => EpisodeStoryArcsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeStoryArcsServices>(c => new EpisodeStoryArcsServices(c.Resolve <IEpisodeStoryArcsBusinessWorkflow>()));
     container.Register(c => EpisodeStoryArcFirstAppearancesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeStoryArcFirstAppearancesServices>(c => new EpisodeStoryArcFirstAppearancesServices(c.Resolve <IEpisodeStoryArcFirstAppearancesBusinessWorkflow>()));
     container.Register(c => EpisodeTeamsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeTeamsServices>(c => new EpisodeTeamsServices(c.Resolve <IEpisodeTeamsBusinessWorkflow>()));
     container.Register(c => EpisodeTeamFirstAppearancesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IEpisodeTeamFirstAppearancesServices>(c => new EpisodeTeamFirstAppearancesServices(c.Resolve <IEpisodeTeamFirstAppearancesBusinessWorkflow>()));
     #endregion
     #region Issues
     container.Register(c => IssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IIssuesServices>(c => new IssuesServices(c.Resolve <IIssuesBusinessWorkflow>()));
     container.Register(c => IssueAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IIssueAliasesServices>(c => new IssueAliasesServices(c.Resolve <IIssueAliasesBusinessWorkflow>()));
     container.Register(c => IssueWritersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IIssueWritersServices>(c => new IssueWritersServices(c.Resolve <IIssueWritersBusinessWorkflow>()));
     #endregion
     #region Locations
     container.Register(c => LocationsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ILocationsServices>(c => new LocationsServices(c.Resolve <ILocationsBusinessWorkflow>()));
     container.Register(c => LocationAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ILocationAliasesServices>(c => new LocationAliasesServices(c.Resolve <ILocationAliasesBusinessWorkflow>()));
     container.Register(c => LocationAppearedInIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ILocationAppearedInIssuesServices>(c => new LocationAppearedInIssuesServices(c.Resolve <ILocationAppearedInIssuesBusinessWorkflow>()));
     container.Register(c => LocationIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ILocationIssuesServices>(c => new LocationIssuesServices(c.Resolve <ILocationIssuesBusinessWorkflow>()));
     container.Register(c => LocationMoviesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ILocationMoviesServices>(c => new LocationMoviesServices(c.Resolve <ILocationMoviesBusinessWorkflow>()));
     container.Register(c => LocationStoryArcsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ILocationStoryArcsServices>(c => new LocationStoryArcsServices(c.Resolve <ILocationStoryArcsBusinessWorkflow>()));
     container.Register(c => LocationVolumesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ILocationVolumesServices>(c => new LocationVolumesServices(c.Resolve <ILocationVolumesBusinessWorkflow>()));
     #endregion
     #region Media
     container.Register(c => ImageFilesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IImageFilesServices>(c => new ImageFilesServices(c.Resolve <IImageFilesBusinessWorkflow>()));
     #endregion
     #region Movies
     container.Register(c => MoviesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMoviesServices>(c => new MoviesServices(c.Resolve <IMoviesBusinessWorkflow>()));
     container.Register(c => MovieCharactersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieCharactersServices>(c => new MovieCharactersServices(c.Resolve <IMovieCharactersBusinessWorkflow>()));
     container.Register(c => MovieConceptsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieConceptsServices>(c => new MovieConceptsServices(c.Resolve <IMovieConceptsBusinessWorkflow>()));
     container.Register(c => MovieLocationsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieLocationsServices>(c => new MovieLocationsServices(c.Resolve <IMovieLocationsBusinessWorkflow>()));
     container.Register(c => MovieObjectsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieObjectsServices>(c => new MovieObjectsServices(c.Resolve <IMovieObjectsBusinessWorkflow>()));
     container.Register(c => MovieProducersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieProducersServices>(c => new MovieProducersServices(c.Resolve <IMovieProducersBusinessWorkflow>()));
     container.Register(c => MovieStoryArcsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieStoryArcsServices>(c => new MovieStoryArcsServices(c.Resolve <IMovieStoryArcsBusinessWorkflow>()));
     container.Register(c => MovieStudiosMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieStudiosServices>(c => new MovieStudiosServices(c.Resolve <IMovieStudiosBusinessWorkflow>()));
     container.Register(c => MovieTeamsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieTeamsServices>(c => new MovieTeamsServices(c.Resolve <IMovieTeamsBusinessWorkflow>()));
     container.Register(c => MovieWritersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IMovieWritersServices>(c => new MovieWritersServices(c.Resolve <IMovieWritersBusinessWorkflow>()));
     #endregion
     #region Object
     container.Register(c => ObjectsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IObjectsServices>(c => new ObjectsServices(c.Resolve <IObjectsBusinessWorkflow>()));
     container.Register(c => ObjectAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IObjectAliasesServices>(c => new ObjectAliasesServices(c.Resolve <IObjectAliasesBusinessWorkflow>()));
     container.Register(c => ObjectAppearedInIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IObjectAppearedInIssuesServices>(c => new ObjectAppearedInIssuesServices(c.Resolve <IObjectAppearedInIssuesBusinessWorkflow>()));
     container.Register(c => ObjectIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IObjectIssuesServices>(c => new ObjectIssuesServices(c.Resolve <IObjectIssuesBusinessWorkflow>()));
     container.Register(c => ObjectMoviesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IObjectMoviesServices>(c => new ObjectMoviesServices(c.Resolve <IObjectMoviesBusinessWorkflow>()));
     container.Register(c => ObjectStoryArcsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IObjectStoryArcsServices>(c => new ObjectStoryArcsServices(c.Resolve <IObjectStoryArcsBusinessWorkflow>()));
     container.Register(c => ObjectVolumesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IObjectVolumesServices>(c => new ObjectVolumesServices(c.Resolve <IObjectVolumesBusinessWorkflow>()));
     #endregion
     #region Origins
     container.Register(c => OriginsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IOriginsServices>(c => new OriginsServices(c.Resolve <IOriginsBusinessWorkflow>()));
     container.Register(c => OriginProfilesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IOriginProfilesServices>(c => new OriginProfilesServices(c.Resolve <IOriginProfilesBusinessWorkflow>()));
     #endregion
     #region People
     container.Register(c => GendersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IGendersServices>(c => new GendersServices(c.Resolve <IGendersBusinessWorkflow>()));
     container.Register(c => CreatorCharactersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ICreatorCharactersServices>(c => new CreatorCharactersServices(c.Resolve <ICreatorCharactersBusinessWorkflow>()));
     container.Register(c => PeopleMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IPeopleServices>(c => new PeopleServices(c.Resolve <IPeopleBusinessWorkflow>()));
     container.Register(c => PersonAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IPersonAliasesServices>(c => new PersonAliasesServices(c.Resolve <IPersonAliasesBusinessWorkflow>()));
     #endregion
     #region Powers
     container.Register(c => PowersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IPowersServices>(c => new PowersServices(c.Resolve <IPowersBusinessWorkflow>()));
     container.Register(c => PowerAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IPowerAliasesServices>(c => new PowerAliasesServices(c.Resolve <IPowerAliasesBusinessWorkflow>()));
     #endregion
     #region Profiles
     container.Register(c => ProfilesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IProfilesServices>(c => new ProfilesServices(c.Resolve <IProfilesBusinessWorkflow>()));
     #endregion
     #region Promos
     container.Register(c => PromosMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IPromosServices>(c => new PromosServices(c.Resolve <IPromosBusinessWorkflow>()));
     container.Register(c => ResourceTypesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IResourceTypesServices>(c => new ResourceTypesServices(c.Resolve <IResourceTypesBusinessWorkflow>()));
     #endregion
     #region Publishers
     container.Register(c => PublishersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IPublishersServices>(c => new PublishersServices(c.Resolve <IPublishersBusinessWorkflow>()));
     container.Register(c => PublisherAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IPublisherAliasesServices>(c => new PublisherAliasesServices(c.Resolve <IPublisherAliasesBusinessWorkflow>()));
     #endregion
     #region Series
     container.Register(c => SeriesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ISeriesServices>(c => new SeriesServices(c.Resolve <ISeriesBusinessWorkflow>()));
     container.Register(c => SeriesAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ISeriesAliasesServices>(c => new SeriesAliasesServices(c.Resolve <ISeriesAliasesBusinessWorkflow>()));
     container.Register(c => SeriesCharactersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ISeriesCharactersServices>(c => new SeriesCharactersServices(c.Resolve <ISeriesCharactersBusinessWorkflow>()));
     container.Register(c => SeriesLocationsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ISeriesLocationsServices>(c => new SeriesLocationsServices(c.Resolve <ISeriesLocationsBusinessWorkflow>()));
     #endregion
     #region StoryArcs
     container.Register(c => StoryArcsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IStoryArcsServices>(c => new StoryArcsServices(c.Resolve <IStoryArcsBusinessWorkflow>()));
     container.Register(c => StoryArcAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IStoryArcAliasesServices>(c => new StoryArcAliasesServices(c.Resolve <IStoryArcAliasesBusinessWorkflow>()));
     container.Register(c => StoryArcIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IStoryArcIssuesServices>(c => new StoryArcIssuesServices(c.Resolve <IStoryArcIssuesBusinessWorkflow>()));
     container.Register(c => StoryArcWritersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IStoryArcWritersServices>(c => new StoryArcWritersServices(c.Resolve <IStoryArcWritersBusinessWorkflow>()));
     #endregion
     #region Studios
     container.Register(c => StudiosMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IStudiosServices>(c => new StudiosServices(c.Resolve <IStudiosBusinessWorkflow>()));
     #endregion
     #region Teams
     container.Register(c => TeamsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamsServices>(c => new TeamsServices(c.Resolve <ITeamsBusinessWorkflow>()));
     container.Register(c => TeamAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamAliasesServices>(c => new TeamAliasesServices(c.Resolve <ITeamAliasesBusinessWorkflow>()));
     container.Register(c => TeamAppearedInIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamAppearedInIssuesServices>(c => new TeamAppearedInIssuesServices(c.Resolve <ITeamAppearedInIssuesBusinessWorkflow>()));
     container.Register(c => TeamCharacterEnemiesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamCharacterEnemiesServices>(c => new TeamCharacterEnemiesServices(c.Resolve <ITeamCharacterEnemiesBusinessWorkflow>()));
     container.Register(c => TeamCharacterFriendsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamCharacterFriendsServices>(c => new TeamCharacterFriendsServices(c.Resolve <ITeamCharacterFriendsBusinessWorkflow>()));
     container.Register(c => TeamDisbandedInIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamDisbandedInIssuesServices>(c => new TeamDisbandedInIssuesServices(c.Resolve <ITeamDisbandedInIssuesBusinessWorkflow>()));
     container.Register(c => TeamIssuesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamIssuesServices>(c => new TeamIssuesServices(c.Resolve <ITeamIssuesBusinessWorkflow>()));
     container.Register(c => TeamMembersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamMembersServices>(c => new TeamMembersServices(c.Resolve <ITeamMembersBusinessWorkflow>()));
     container.Register(c => TeamMoviesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamMoviesServices>(c => new TeamMoviesServices(c.Resolve <ITeamMoviesBusinessWorkflow>()));
     container.Register(c => TeamStoryArcsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamStoryArcsServices>(c => new TeamStoryArcsServices(c.Resolve <ITeamStoryArcsBusinessWorkflow>()));
     container.Register(c => TeamVolumesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <ITeamVolumesServices>(c => new TeamVolumesServices(c.Resolve <ITeamVolumesBusinessWorkflow>()));
     #endregion
     #region Videos
     container.Register(c => VideosMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVideosServices>(c => new VideosServices(c.Resolve <IVideosBusinessWorkflow>()));
     container.Register(c => VideoTypesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVideoTypesServices>(c => new VideoTypesServices(c.Resolve <IVideoTypesBusinessWorkflow>()));
     #endregion
     #region Volumes
     container.Register(c => VolumesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumesServices>(c => new VolumesServices(c.Resolve <IVolumesBusinessWorkflow>()));
     container.Register(c => VolumeAliasesMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumeAliasesServices>(c => new VolumeAliasesServices(c.Resolve <IVolumeAliasesBusinessWorkflow>()));
     container.Register(c => VolumeCharactersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumeCharactersServices>(c => new VolumeCharactersServices(c.Resolve <IVolumeCharactersBusinessWorkflow>()));
     container.Register(c => VolumeConceptsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumeConceptsServices>(c => new VolumeConceptsServices(c.Resolve <IVolumeConceptsBusinessWorkflow>()));
     container.Register(c => VolumeLocationsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumeLocationsServices>(c => new VolumeLocationsServices(c.Resolve <IVolumeLocationsBusinessWorkflow>()));
     container.Register(c => VolumeObjectsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumeObjectsServices>(c => new VolumeObjectsServices(c.Resolve <IVolumeObjectsBusinessWorkflow>()));
     container.Register(c => VolumeTeamsMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumeTeamsServices>(c => new VolumeTeamsServices(c.Resolve <IVolumeTeamsBusinessWorkflow>()));
     container.Register(c => VolumeWritersMockingSetup.DoMockingSetupForBusinessWorkflow().Object);
     container.Register <IVolumeWritersServices>(c => new VolumeWritersServices(c.Resolve <IVolumeWritersBusinessWorkflow>()));
     #endregion
 }
 public override void Configure(Funq.Container container)
 {
     container.Register <ICacheClient>(new MemoryCacheClient());
 }
Beispiel #24
0
        // This is the "Composition Root" in the IoC pattern that wires all
        // our objects/implementations up, based on a given configuration.
        // config sanity checks SHOULD NOT go here

        private static void ComposeObjectGraph(Funq.Container container)
        {
            var config = Config.Global;

            container.Register <SqliteConfig> (c => new SqliteConfig {
                File = Path.Combine(config.DataPath, "rainy.db")
            });

            container.Register <PostgreConfig> (c => {
                dynamic txt_conf = config.Postgre;
                var psql_conf    = new PostgreConfig();
                if (!string.IsNullOrEmpty(txt_conf.Username))
                {
                    psql_conf.Username = txt_conf.Username;
                }
                if (!string.IsNullOrEmpty(txt_conf.Password))
                {
                    psql_conf.Password = txt_conf.Password;
                }
                if (!string.IsNullOrEmpty(txt_conf.Database))
                {
                    psql_conf.Database = txt_conf.Database;
                }
                if (!string.IsNullOrEmpty(txt_conf.Host))
                {
                    psql_conf.Host = txt_conf.Host;
                }
                if (txt_conf.Port > 0)
                {
                    psql_conf.Port = (uint)txt_conf.Port;
                }

                return(psql_conf);
            });

            if (config.Backend == "xml")
            {
                // use username/password pairs from the config file
                container.Register <IAuthenticator> (c => {
                    return(new ConfigFileAuthenticator(config.User));
                });

                // we store notes in XML files in the DataPath
                container.Register <IDataBackend> (c => {
                    var auth          = c.Resolve <IAuthenticator> ();
                    var factory       = c.Resolve <IDbConnectionFactory> ();
                    var oauth_handler = c.Resolve <OAuthHandler> ();
                    return(new FileSystemBackend(config.DataPath, factory, auth, oauth_handler, false));
                });
            }
            else
            {
                // database based backends
                switch ((string)config.Backend)
                {
                case "sqlite":
                    container.Register <IDbConnectionFactory> (c => {
                        var conf = container.Resolve <SqliteConfig> ();
                        var connection_string = conf.ConnectionString;
                        var factory           = new OrmLiteConnectionFactory(connection_string, SqliteDialect.Provider);

                        if (!File.Exists(conf.File))
                        {
                            DatabaseBackend.CreateSchema(factory);
                        }

                        return((IDbConnectionFactory)factory);
                    });
                    break;

                case "postgre":
                    container.Register <IDbConnectionFactory> (c => {
                        var connection_string = container.Resolve <PostgreConfig> ().ConnectionString;
                        var factory           = new OrmLiteConnectionFactory(connection_string, PostgreSqlDialect.Provider);
                        DatabaseBackend.CreateSchema(factory);
                        return(factory);
                    });
                    break;
                }

                container.Register <IAuthenticator> (c => {
                    var factory = c.Resolve <IDbConnectionFactory> ();
//					var sfactory = new OrmLiteConnectionFactory ();
                    var dbauth = new DbAuthenticator(factory);
                    //var dbauth = new ConfigFileAuthenticator (Config.Global.Users);

                    // we have to make sure users from the config file exist with the configured password
                    // in the db
                    // TODO delete old users? or restrict to webinterface?
                    if (dbauth is ConfigFileAuthenticator)
                    {
                        foreach (dynamic user in Config.Global.Users)
                        {
                            string username = user.Username;
                            string password = user.Password;
                            using (var db = factory.OpenDbConnection()) {
                                var db_user = db.FirstOrDefault <DBUser> (u => u.Username == username);
                                if (db_user != null)
                                {
                                    var need_update = db_user.UpdatePassword(password);
                                    if (need_update)
                                    {
                                        db.UpdateOnly(new DBUser {
                                            PasswordHash = db_user.PasswordHash
                                        }, u => new { u.PasswordHash }, (DBUser p) => p.Username == username);
                                    }
                                }
                                else
                                {
                                    // create the user in the db
                                    var new_user      = new DBUser();
                                    new_user.Username = username;
                                    new_user.CreateCryptoFields(password);
                                    new_user.UpdatePassword(password);
                                    db.Insert <DBUser> (new_user);
                                }
                            }
                        }
                    }
                    return(dbauth);
                });
//
                container.Register <IAdminAuthenticator> (c => {
                    var auth = new ConfigFileAdminAuthenticator();
                    return(auth);
                });

                container.Register <OAuthHandler> (c => {
                    var auth    = c.Resolve <IAuthenticator> ();
                    var factory = c.Resolve <IDbConnectionFactory> ();
                    //				ITokenRepository<AccessToken> access_tokens = new SimpleTokenRepository<AccessToken> ();
                    //				ITokenRepository<RequestToken> request_tokens = new SimpleTokenRepository<RequestToken> ();
                    ITokenRepository <AccessToken> access_tokens   = new DbAccessTokenRepository <AccessToken> (factory);
                    ITokenRepository <RequestToken> request_tokens = new DbRequestTokenRepository <RequestToken> (factory);
                    ITokenStore token_store = new RainyTokenStore(access_tokens, request_tokens);
                    OAuthHandler handler    = new OAuthHandler(auth, access_tokens, request_tokens, token_store);
                    return(handler);
                });

                container.Register <DbStorageFactory> (c => {
                    var conn_factory    = c.Resolve <IDbConnectionFactory> ();
                    bool use_encryption = (bool)Config.Global.UseNoteEncryption;

                    var storage_factory = new DbStorageFactory(conn_factory, use_encryption, use_history: true);
                    return(storage_factory);
                });

                container.Register <IDataBackend> (c => {
                    var conn_factory    = c.Resolve <IDbConnectionFactory> ();
                    var storage_factory = c.Resolve <DbStorageFactory> ();
                    var handler         = c.Resolve <OAuthHandler> ();
                    var auth            = c.Resolve <IAuthenticator> ();
                    return(new DatabaseBackend(conn_factory, storage_factory, auth, handler));
                });

/*				container.Register<OAuthHandler> (c => {
 *                                      var factory = c.Resolve<IDbConnectionFactory> ();
 *                                      var access_token_repo = new DbAccessTokenRepository<AccessToken> (factory);
 *                                      var request_token_repo = new SimpleTokenRepository<RequestToken> ();
 *                                      var auth = c.Resolve<IAuthenticator> ();
 *                                      var token_store = new Rainy.OAuth.SimpleStore.SimpleTokenStore (access_token_repo, request_token_repo);
 *
 *                                      var handler = new OAuthHandler (auth, token_store);
 *                                      return handler;
 *                              });
 */
                if (config.Development == true)
                {
                    AddDummyUserIfRequired(container);
                }
            }
        }
Beispiel #25
0
        public override void Configure(Funq.Container container)
        {
            var host = ConfigurationManager.AppSettings.Get("PaypalWebsiteURL");

            SetConfig(new EndpointHostConfig
            {
                DebugMode = false, // Debugmode for stacktrace

                GlobalResponseHeaders =
                {
                    { "Access-Control-Allow-Origin",  "*"                               },
                    { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" }
                },
                //EnableFeatures = Feature.All.Remove(GetDisabledFeatures()),
                EnableFeatures = ServiceStack.ServiceHost.Feature.All,
                //RestrictAllCookiesToDomain = "www.photobookmart.com"
                //ServiceStackHandlerFactoryPath = "api",
                //AppendUtf8CharsetOnContentTypes = new HashSet<string> { ContentType.Html },
            });

            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = false;

            //Register a external dependency-free
            //container.Register<ICacheClient>(new MemoryCacheClient());

            /* TODO:...
             * var redis_host = ConfigurationManager.AppSettings.Get("RedisHost");
             * var redis_db = long.Parse(ConfigurationManager.AppSettings.Get("RedisDBVersion"));
             * var pooled_redis = new PooledRedisClientManager(redis_db, redis_host);
             * pooled_redis.NamespacePrefix = System.Reflection.Assembly.GetExecutingAssembly().FullName;
             * container.Register<IRedisClientsManager>(c => pooled_redis);
             * container.Register<ICacheClient>(c =>
             *  (ICacheClient)c.Resolve<IRedisClientsManager>()
             *  .GetCacheClient())
             *  .ReusedWithin(Funq.ReuseScope.None);*/


            //Enable Authentication an Registration
            VMCCredenticalsProvider authProvider = new VMCCredenticalsProvider();

            Plugins.Add(new SessionFeature());
            AuthFeature authFeature = new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
                authProvider, new BasicAuthProvider()
            });

            //authFeature.ServiceRoutes.Clear(); // we clear all routes
            Plugins.Add(authFeature);
            Plugins.Add(new RegistrationFeature());


            //Create a DB Factory configured to access the UserAuth SQL Server DB
            dbFactory = GetDbConnectionFromConfig();
            //container.Register(c => GetDbConnectionFromConfig()).ReusedWithin(Funq.ReuseScope.Container);
            //var dbConnection = container.Resolve<OrmLiteConnectionFactory>();
            container.Register <IDbConnectionFactory>(dbFactory);
            //container.Register(c => GetDbConnectionFromConfig()).ReusedWithin(Funq.ReuseScope.Request);

            // register db connection
            //container.Register(c => dbFactory.OpenDbConnection()).ReusedWithin(Funq.ReuseScope.Container);
            DatabaseConnection = dbFactory.OpenDbConnection();
            container.Register(c => dbFactory.OpenDbConnection()).ReusedWithin(Funq.ReuseScope.Container);
            //container.Register<IDbConnection>(DatabaseConnection);
            // caching  - TODO: later must change to ORMLiteCache
            //container.RegisterAs<OrmLiteCacheClient, ICacheClient>();
            //Create 'CacheEntry' RDBMS table if it doesn't exist already
            //container.Resolve<ICacheClient>().InitSchema();
            // end of caching register

            // create tables
            ModelBase.InitDbTable(ConfigurationManager.AppSettings.Get("AdminUserNames"), true, true);

            //container.RegisterAutoWired<IDbConnection>();
            //container.Register<IDbConnectionFactory>(dbConnection);
            // Register ORM Lite Authentication Repository with our Authentication
            var userRep = new ABORMLiteAuthRepository(dbFactory);

            container.Register <IAuthProvider>(authProvider);
            container.Register <IUserAuthRepository>(userRep);

            //Configure Custom User Defined REST Paths for your services
            ConfigureServiceRoutes();

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            //ServiceStackController.CatchAllController = reqCtx => container.TryResolve<HomeController>();
        }
Beispiel #26
0
        public override void Configure(Funq.Container container)
        {
            JsConfig.IncludeNullValues  = true;
            JsConfig.AlwaysUseUtc       = true;
            JsConfig.AssumeUtc          = true;
            JsConfig.TreatEnumAsInteger = true;
            JsConfig.DateHandler        = DateHandler.ISO8601;

            SetConfig(new HostConfig {
                DebugMode = true, ApiVersion = "1"
            });

            container.Adapter = new StructureMapContainerAdapter(_container);

            Plugins.Add(new AuthFeature(() => new AuthUserSession(),
                                        new IAuthProvider[] {
                new JwtAuthProvider(AppSettings)
                {
                    RequireSecureConnection = false
                },
                new BasicAuthProvider(),       //Sign-in with HTTP Basic Auth
                new CredentialsAuthProvider(), //HTML Form post of UserName/Password credentials
            }));
            Plugins.Add(new RegistrationFeature());
            container.Register <IUserAuthRepository>(x => new DomainAuthRepository(x.Resolve <IBus>()));

            Plugins.Add(new SessionFeature());
            Plugins.Add(new SwaggerFeature());
            Plugins.Add(new NativeTypesFeature());

            Plugins.Add(new PostmanFeature
            {
                DefaultLabelFmt = new List <String> {
                    "type: english", " ", "route"
                }
            });
            Plugins.Add(new CorsFeature(
                            allowOriginWhitelist: new[] {
                "http://localhost:8080",
                "http://localhost:9000",
                "http://Demo.development.syndeonetwork.com",
                "http://Demo.syndeonetwork.com"
            },
                            allowCredentials: true,
                            allowedHeaders: "Content-Type, Authorization",
                            allowedMethods: "GET, POST, PUT, DELETE, OPTIONS"
                            ));


            Plugins.Add(new ValidationFeature());
            Plugins.Add(new Profiling.MetricsFeature());
            Plugins.Add(new ServerEventsFeature());
            Plugins.Add(new ServiceStack.Authentication.Plugin());

            var nativeTypes = this.GetPlugin <NativeTypesFeature>();

            nativeTypes.MetadataTypesConfig.GlobalNamespace = "Demo.DTOs";

            //container.Register<IRedisClientsManager>(c =>
            //    new PooledRedisClientManager("localhost:6379"));
            //container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());
            //container.Register(c => c.Resolve<IRedisClientsManager>().GetClient());

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

            //container.Register<IBus>(bus);
        }
Beispiel #27
0
        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
            CacheController.RegisterCache(string.Empty /* connectionString */, new ResultsetCache(5 * 60 /* will purge the cache every 5 minutes */));
        }
Beispiel #28
0
 public static Funq.Container Build(Funq.Container container)
 {
     container.Register <HostContext>(c => HostContext.Instance).ReusedWithin(Funq.ReuseScope.Request);
     container = PatientNoteContainer.Configure(container);
     return(container);
 }
Beispiel #29
0
        /// <summary>
        /// This method is used to configure things like Inversion-of-Control Containers
        /// </summary>
        /// <param name=“container”></param>
        public override void Configure(Funq.Container container)
        {
            //Plugins.Add(new SwaggerFeature());

            Plugins.Add(new AuthFeature(
                            () => new AuthUserSession(),
                            new IAuthProvider[] { new BasicAuthProvider(), }));

            container.Register <ICacheClient>(new MemoryCacheClient());
            var userRepository = new InMemoryAuthRepository();

            container.Register <IUserAuthRepository>(userRepository);

            string hash;
            string salt;

            new SaltedHash().GetHashAndSaltString("_!p@$$w0rd!_", out hash, out salt);
            userRepository.CreateUserAuth(new UserAuth {
                Id = 1, UserName = "******"
            }, "_!p@$$w0rd!_");

            // Add our IDbConnectionFactory to the container,
            // this will allow all of our services to share a single connection factory
            container.Register <IDbConnectionFactory>(new OrmLiteConnectionFactory(ConnectionString, SqlServerOrmLiteDialectProvider.Instance));

            //// Below we refer to the connection factory that we just registered
            //// with the container and use it to create our table(s).
            //using (var db = container.Resolve<IDbConnectionFactory>().Open())
            //{
            //    // We’re just creating a single table, but you could add
            //    // as many as you need.  Also note the “overwrite: false” parameter,
            //    // this will only create the table if it doesn’t already exist.
            //    db.CreateTable<OwnerTable>(overwrite: false);
            //    db.CreateTable<PetTable>(overwrite: false);
            //    db.CreateTable<OwnerPetTable>(overwrite: false);
            //    db.CreateTable<ParameterGroupTable>(overwrite: false);
            //    db.CreateTable<ParameterValueTable>(overwrite: false);
            //}

            container.RegisterAutoWiredAs <OwnerProvider, IOwnerProvider>();
            container.RegisterAutoWiredAs <OwnerMapper, IOwnerMapper>();
            container.RegisterAutoWiredAs <OwnerDataAccess, IOwnerDataAccess>();

            container.RegisterAutoWiredAs <PetProvider, IPetProvider>();
            container.RegisterAutoWiredAs <PetMapper, IPetMapper>();
            container.RegisterAutoWiredAs <PetDataAccess, IPetDataAccess>();

            container.RegisterAutoWiredAs <PetAlertProvider, IPetAlertProvider>();
            container.RegisterAutoWiredAs <PetAlertMapper, IPetAlertMapper>();
            container.RegisterAutoWiredAs <PetAlertDataAccess, IPetAlertDataAccess>();

            container.RegisterAutoWiredAs <PetImageProvider, IPetImageProvider>();
            container.RegisterAutoWiredAs <PetImageMapper, IPetImageMapper>();
            container.RegisterAutoWiredAs <PetImageDataAccess, IPetImageDataAccess>();

            container.RegisterAutoWiredAs <PetSearchProvider, IPetSearchProvider>();
            container.RegisterAutoWiredAs <PetSearchMapper, IPetSearchMapper>();
            container.RegisterAutoWiredAs <PetSearchDataAccess, IPetSearchDataAccess>();

            container.RegisterAutoWiredAs <AdminProvider, IAdminProvider>();
            container.RegisterAutoWiredAs <AdminDataAccess, IAdminDataAccess>();

            container.RegisterAutoWiredAs <BaseDataAccess <OwnerTableModel>, IBaseDataAccess <OwnerTableModel> >();
            container.RegisterAutoWiredAs <BaseDataAccess <PetTableModel>, IBaseDataAccess <PetTableModel> >();
            container.RegisterAutoWiredAs <BaseDataAccess <PetImageTableModel>, IBaseDataAccess <PetImageTableModel> >();
            container.RegisterAutoWiredAs <BaseDataAccess <PetAlertTableModel>, IBaseDataAccess <PetAlertTableModel> >();
        }
 public override void Configure(Funq.Container container)
 {
     container.Register <ICacheClient>(c => new MemoryCacheClient()).ReusedWithin(Funq.ReuseScope.None);
 }
Beispiel #31
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.RegisterAutoWiredAs <RavenDocStore, IRavenDocStore>();
            container.RegisterAutoWiredAs <DateTimeUtcFromOlsenMapping, IDateTimeUtcFromOlsenMapping>();
            container.RegisterAutoWiredAs <CoordinatorModelToMessageMapping, ICoordinatorModelToMessageMapping>();
            container.RegisterAutoWiredAs <CoordinatorApiModelToMessageMapping, ICoordinatorApiModelToMessageMapping>();
            container.RegisterAutoWiredAs <CurrentUser, ICurrentUser>();

            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));
        }