Wiki

Clone wiki

HaveBox.WebExtensions / Documentation

Home - News - Documentation

Documentation

License

HaveBox is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

HaveBox.WebExtensions is versioned after following convention:

Major.Minor.Build

A change in:

  • Major: Covers breaking changes, unbreaking changes, bugfixes and optimizations
  • Minor: Unbreaking changes, bugfixes and optimizations
  • Build: Bugfixes and optimizations

Getting HaveBox.WebExtensions

HaveBox.WebExtensions can be downloaded from Nuget:

https://www.nuget.org/packages/HaveBox.WebExtensions/

Or

https://bitbucket.org/Have/havebox.webextensions/downloads

Using HaveBox.WebExtensions

The followering example, is a simple example of how to setup HaveBoxDependencyResolver. For more information about setting up HaveBox, so it suits your project, see the HaveBox Documentation

#!CSharpLexer

using HaveBox;
using HaveBox.WebExtensions;
using HaveBoxJSONBenchmarkStudio.Controllers;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace HaveBoxJSONBenchmarkStudio
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Setting up DI for MVC
            DependencyResolver.SetResolver(new HaveBoxDependencyResolver(CreateContainerAndBootstrap()));

            // Setting up DI for Web Api
            GlobalConfiguration.Configuration.DependencyResolver = new HaveBoxDependencyResolver(CreateContainerAndBootstrap());
        }

        private IContainer CreateContainerAndBootstrap()
        {
            var container = new Container();
            container.Configure(x =>
            {
                x.For<SimpleController>().Use<SimpleController>();
                x.For<AnotherSimpleController>().Use<AnotherSimpleController>();
            });

            return container;
        }
    }
}

Updated