I am creating some WCF services in which I am using Autofac as the IOC. Now I need to create an instance of one of the classes using reflection whose parameters are injected by Autofac. But when I use Activator.CreateInstance its giving exception as the constructor is not there.After I add a parameter less constructor, the paramters passed in the constructor which is supposed to be instantiated by Autofac is not getting instantiated.Anyone please help me in fixing this
Asked
Active
Viewed 96 times
0
-
Why do you have to create instance of class using reflection ? Could you share some code ? – Cyril Durand Nov 18 '15 at 12:43
-
Snippet please. Activator.CreateInstance doesn't know nothing about autofac (as i know) - provide your code sample (we should see .ctor sygnatures of class and Activator.CreateInstance call and how it's binded to autofac – comdiv Nov 18 '15 at 16:41