Unity not using the default constructor of the class

后端 未结 3 418
情深已故
情深已故 2021-01-01 13:29

I have this class :

public class Repo
{
   public Repo() : this(ConfigurationManager.AppSettings[\"identity\"],       ConfigurationManager.AppSettings[\"pass         


        
3条回答
  •  太阳男子
    2021-01-01 14:16

    Just try to register type this way:

    
      
    
    

    Because of no param element specified in constructor element it should call default constructor.

    You can also do this registration in code:

    container.RegisterType(new InjectionConstructor());
    

提交回复
热议问题