<commit_before>﻿//-----------------------------------------------------------------------
// <copyright company="Metamorphic">
//     Copyright 2013 Metamorphic. Licensed under the Apache License, Version 2.0.
// </copyright>
//-----------------------------------------------------------------------

using System;
using Autofac;

namespace Metamorphic.Server
{
    /// <summary>
    /// Creates the dependency injection container with all the required references.
    /// </summary>
    internal static class DependencyInjection
    {
        /// <summary>
        /// Creates the dependency injection container for the application.
        /// </summary>
        /// <returns>The container.</returns>
        public static IContainer CreateContainer()
        {
            throw new NotImplementedException();
        }
    }
}<commit_msg>Start of the dependency injection implementation.<commit_after>﻿//-----------------------------------------------------------------------
// <copyright company="Metamorphic">
//     Copyright 2013 Metamorphic. Licensed under the Apache License, Version 2.0.
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Reflection;
using System.Web.Http;
using Autofac;
using Autofac.Integration.WebApi;

namespace Metamorphic.Server
{
    /// <summary>
    /// Creates the dependency injection container with all the required references.
    /// </summary>
    internal static class DependencyInjection
    {
        /// <summary>
        /// Creates the dependency injection container for the application.
        /// </summary>
        /// <returns>The container.</returns>
        public static IContainer CreateContainer()
        {
            var builder = new ContainerBuilder();
            {
                builder.Register(c => new XmlConfiguration(
                        WebApiConfigurationKeys.ToCollection()
                            .Append(DiagnosticsConfigurationKeys.ToCollection())
                            .ToList(),
                        WebApiConstants.ConfigurationSectionApplicationSettings))
                    .As<IConfiguration>()
                    .SingleInstance();

                builder.Register(c => new NucleiBasedTraceWriter(
                        c.Resolve<SystemDiagnostics>()))
                    .As<ITraceWriter>()
                    .SingleInstance();

                RegisterControllers(builder);
            }

            return builder.Build();
        }

        private static void RegisterControllers(ContainerBuilder builder)
        {
            builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
        }
    }
}
{'fraction_non_alphanumeric': 0.19399109792284866, 'fraction_numerical': 0.004451038575667656, 'mean_word_length': 1.4451495920217587, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3861556', 'n_tokens_mistral': 575, 'n_tokens_neox': 543, 'n_words': 146}