title: asp.net core build-in dependency injection long code
body: <p>In our previous app we used StructureMap and we could write very little code. </p>
  
  <p>before every service we added the dependencies like:</p>
  
  <pre><code>[SetterProperty]
  public IXService XService { get; set; }
  </code></pre>
  
  <p>and in the constructor</p>
  
  <pre><code>ObjectFactory.BuildUp(this);
  </code></pre>
  
  <p>then in test we could instantiate it simply by</p>
  
  <pre><code>var service = new XService();
  </code></pre>
  
  <p>Now, we start another app and using asp.net core build-in DI container.
  it look like we should write a lot of code, and very long constructor for each test:</p>
  
  <pre><code>    private readonly ILogger&lt;AccountsController&gt; _logger;
      private readonly IMapper _mapper;
      private readonly IAccountBlService _accountBlService;
      private readonly IValidationHelper _validationHelper;
      private readonly IValidator&lt;AccountDTO&gt; _accountDTOValidator;
      private readonly Example _example;
      private readonly IConfiguration _configuration;
  
      public AccountsController(BillingContext context, ILogger&lt;AccountsController&gt; logger, IMapper mapper, IAccountBlService accountBlService, 
          IValidationHelper validationHelper, IValidator&lt;AccountDTO&gt; accountDTOValidator, IOptions&lt;Example&gt; example, IConfiguration configuration)
      {
          _logger = logger;
          _mapper = mapper;
          _accountBlService = accountBlService;
          _validationHelper = validationHelper;
          _accountDTOValidator = accountDTOValidator;
          _configuration = configuration;
          _example = example.Value;
      }
  </code></pre>
  
  <p>Is there a shorter way we didnt found? is one planned for the near future? should we use StructureMap instead the built-in container? or there are disadvantages for this? thanks!</p>