<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Ninject;
using FoodProject.Abstract;
using FoodProject.Concrete;
namespace FoodProject.infrastructure
{
        public class NinjectDependencyResolver : IDependencyResolver
        {
            //attributes
            private IKernel kernel;

            //constructor
            public NinjectDependencyResolver(IKernel kernelParam)
            {
                kernel = kernelParam;
                AddBindings();
            }

            //methods
            public object GetService(Type serviceType)
            {
                return kernel.TryGet(serviceType);
            }

            public IEnumerable<object> GetServices(Type serviceType)
            {
                return kernel.GetAll(serviceType);
            }

            private void AddBindings()
            {
                //binds the repositorys to these concrete classes
                kernel.Bind<IUserRepository>().To<UserRepository>();
                kernel.Bind<IFoodRepository>().To<FoodRepository>();
                kernel.Bind<IPantryRepository>().To<PantryRepository>();
                kernel.Bind<IRecipeRepository>().To<RecipeRepository>();
                kernel.Bind<IIngredientRepository>().To<IngredientRepository>();
            }

        }
}<commit_msg>added documentation<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Ninject;
using FoodProject.Abstract;
using FoodProject.Concrete;
namespace FoodProject.infrastructure
{
        /// <summary>
        /// the dependency injection contianer, it uses constructor injection
        /// </summary>
        public class NinjectDependencyResolver : IDependencyResolver
        {
            //attributes
            private IKernel kernel;

            //constructor
            public NinjectDependencyResolver(IKernel kernelParam)
            {
                kernel = kernelParam;
                AddBindings();
            }

            //methods
            public object GetService(Type serviceType)
            {
                return kernel.TryGet(serviceType);
            }

            public IEnumerable<object> GetServices(Type serviceType)
            {
                return kernel.GetAll(serviceType);
            }
            /// <summary>
            /// This method adds the bindings to the interfaces we created
            /// if you wanted to change what the concrete implmentiaon the interface will refer to
            /// you edit this method
            /// </summary>
            private void AddBindings()
            {
                //binds the repositorys to these concrete classes
                kernel.Bind<IUserRepository>().To<UserRepository>();
                kernel.Bind<IFoodRepository>().To<FoodRepository>();
                kernel.Bind<IPantryRepository>().To<PantryRepository>();
                kernel.Bind<IRecipeRepository>().To<RecipeRepository>();
                kernel.Bind<IIngredientRepository>().To<IngredientRepository>();
            }

        }
}
{'fraction_non_alphanumeric': 0.08694267515923566, 'fraction_numerical': 0.0, 'mean_word_length': 1.8019625334522749, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '1465110', 'n_tokens_mistral': 735, 'n_tokens_neox': 702, 'n_words': 159}