Source

Camino / src / Empi.Camino / DIContainer.cs

Full commit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using Empi.Camino.Web.Data;
using Empi.Camino.Web;

namespace Empi.Camino
{
    internal class DIContainer
    {
        private IUnityContainer _DIContainer = new UnityContainer();

        private DIContainer()
        {
            Initialize();
        }


        internal static DIContainer GetDIContainer()
        {
            return DataStoreFactory.GetApplicationDataStore.LazyGet<DIContainer>("DIContainer", () => new DIContainer());
        }

        private void Initialize()
        {
            //MP: mache eine tabelle {Baseclass, Class, Name}
            //MP: initialize from DataBase

            _DIContainer.RegisterType(typeof(IFileResourceProvider), typeof(LocalResourceProvider), "local");
        }

        public T Resolve<T>(string name)
        {
            return _DIContainer.Resolve<T>(name);
        }

    }
}