コード例 #1
0
        public void Register <T>(DependencyLocatorTarget target) where T : class
        {
            var newBuilder = new ContainerBuilder();

            InstanceConfiguration(newBuilder.RegisterType <T>(), target);
            newBuilder.Update(_container);
        }
コード例 #2
0
        private IRegistrationBuilder <T, ConcreteReflectionActivatorData, SingleRegistrationStyle> InstanceConfiguration <T>(IRegistrationBuilder <T, ConcreteReflectionActivatorData, SingleRegistrationStyle> registrationBuilder, DependencyLocatorTarget target) where T : class
        {
            switch (target)
            {
            case DependencyLocatorTarget.GlobalInstance:
                return(registrationBuilder.SingleInstance());

            case DependencyLocatorTarget.NewInstance:
                return(registrationBuilder);

            default:
                throw new NotSupportedException();
            }
        }
コード例 #3
0
 public static void Register <T1, T2>(DependencyLocatorTarget target = DependencyLocatorTarget.GlobalInstance) where T2 : class, T1 where T1 : class
 {
     m_provider.Register <T1, T2>(target);
 }