using System.Collections.Generic;
using Ninject;

namespace WindowsDataCenter
{
    public class NinjectHelper
    {
        private static NinjectHelper _instance;
        private static readonly object LockObject = new object();

        public StandardKernel Kernel { get; private set; }

        public static NinjectHelper GetInstance()
        {
            if (_instance != null)
                return _instance;
            lock (LockObject)
            {
                _instance = new NinjectHelper();
                return _instance;
            }
        }

        private NinjectHelper()
        {
            Kernel = Configuration.ConfigureNinject();
        }
        
        public T Get<T>()
        {
            return Kernel.Get<T>();
        }

        public IEnumerable<T> GetAll<T>()
        {
            return Kernel.GetAll<T>();
        }
    }
}