示例#1
0
 private static TypedValue CreateWithoutParameters(RuntimeType runtimeType)
 {
     try {
         return(runtimeType.CreateInstance());
     }
     catch (Exception e) {
         throw new CreateException(runtimeType.Type, 0, e);
     }
 }
示例#2
0
 static TypedValue CreateWithoutParameters(RuntimeType runtimeType)
 {
     try {
         return(runtimeType.CreateInstance());
     }
     catch (System.Exception e) {
         throw new CreateException(runtimeType.Type, 0, e.InnerException ?? e);
     }
 }
示例#3
0
        public static void TestSet17_Method1()
        {
            //TestSet7
            var container = new Container();

            container.RegisterType <Type>();
            var typeActivator = new TypeActivator();
            var runtimeType   = new RuntimeType(typeActivator, new InjectionAttribute("Build.Tests.TestSet17.Type"), typeof(Type), true);

            runtimeType.SetRuntimeInstance(RuntimeInstance.CreateInstance);
            Assert.Throws <TypeInstantiationException>(() => runtimeType.CreateInstance(new object[] { "Build.Tests.TestSet17.Type" }));
        }
示例#4
0
        public static void TestSet17_Method5()
        {
            //TestSet7
            var container = new Container();

            container.RegisterType <Type>();
            var typeActivator = new TypeActivator();
            var runtimeType   = new RuntimeType(typeActivator, new InjectionAttribute("Build.Tests.TestSet17.Type"), typeof(Type), true);

            runtimeType.SetRuntimeInstance(RuntimeInstance.CreateInstance);
            runtimeType.AddConstructorParameter(((TypeBuilder)container.Builder).CanRegister(runtimeType.ActivatorType), new RuntimeType(typeActivator, new InjectionAttribute(typeof(Type)), typeof(Type), true));
            Assert.Throws <TypeInstantiationException>(() => runtimeType.CreateInstance((string[])null));
        }