private void Setup(TfsDriveParameter dynamicParameters)
        {
            Container = new UnityContainer();
            Container.AddNewExtension <Interception>();

            //Container.RegisterType<IContainer, TfsDrive>(new TransientLifetimeManager(), new InterceptionBehavior<PolicyInjectionBehavior>(), new Interceptor<InterfaceInterceptor>());
            Container.RegisterType <IContainer, TfsDrive>(new TransientLifetimeManager());
            Container.RegisterType <CachingLifetimeManager>(new ContainerControlledLifetimeManager());

            if (null != dynamicParameters.DataService)
            {
                Container.RegisterInstance(dynamicParameters.DataService);
            }
            else
            {
                Container.RegisterType <ITfsDataService, TfsRestDataService>(new ContainerControlledLifetimeManager(), new InjectionConstructor(
                                                                                 new InjectionParameter <string>(dynamicParameters.Url),
                                                                                 new InjectionParameter <string>(dynamicParameters.AccessToken)
                                                                                 ), new InterceptionBehavior <PolicyInjectionBehavior>(), new Interceptor <InterfaceInterceptor>());
            }

            PolicyDefinition loggingPolicy = Container.Configure <Interception>().AddPolicy("logging");

            loggingPolicy.AddMatchingRule <AssemblyMatchingRule>(new InjectionConstructor(new InjectionParameter(GetType().Assembly.FullName)));
            loggingPolicy.AddCallHandler <LoggingCallHandler>(new ContainerControlledLifetimeManager(), new InjectionConstructor());
            loggingPolicy.AddCallHandler <PerformanceMeasurementHandler>(new ContainerControlledLifetimeManager(), new InjectionConstructor());
            loggingPolicy.AddCallHandler <CachingCallHandler>(Container.Resolve <CachingLifetimeManager>(), new InjectionConstructor());

            TfsDataService = Container.Resolve <ITfsDataService>();
        }
 public TfsDriveInfo(PSDriveInfo driveInfo, TfsDriveParameter dynamicParameters) : base(driveInfo)
 {
     Setup(dynamicParameters);
 }