/// <summary>Configures the given container.</summary>
        ///
        /// <param name="container">The container.</param>
        public override void Configure(Container container)
        {
            container.Register <IResourceManager>(new ConfigurationResourceManager());

            container.Register(c => new ExampleConfig(c.Resolve <IResourceManager>()));
            //var appConfig = container.Resolve<ExampleConfig>();

            container.Register <IDbConnectionFactory>(c =>
                                                      new OrmLiteConnectionFactory(
                                                          ":memory:",   //Use an in-memory database instead
                                                          false,        //keep the same in-memory db connection open
                                                          SqliteOrmLiteDialectProvider.Instance));

            Routes.Add <Movies>("/custom-movies", "GET")
            .Add <Movies>("/custom-movies/genres/{Genre}")
            .Add <Movie>("/custom-movies", "POST,PUT")
            .Add <Movie>("/custom-movies/{Id}");

            ConfigureDatabase.Init(container.Resolve <IDbConnectionFactory>());
        }
Example #2
0
        /// <summary>Executes the post action.</summary>
        ///
        /// <param name="request">The request.</param>
        ///
        /// <returns>An object.</returns>
        public object OnPost(ResetMovies request)
        {
            ConfigureDatabase.Init(TryResolve <IDbConnectionFactory>());

            return(new ResetMoviesResponse());
        }