title: Error While validating the service descriptor
body: <p>I'm trying to create a demo to present DapperExtensions benefits. I'm stuck at a point. While starting the project I get a error about servicetype.
  The error :</p>
  <blockquote>
  <p>&quot;Some services are not able to be constructed (Error while validating
  the service descriptor 'ServiceType:
  ImOnTech.Teftis.DAL.Interfaces.DT_Inspection.ICityRepository Lifetime:
  Transient ImplementationType:
  ImOnTech.Teftis.DAL.Repositories.DT_Inspection.CityRepository': Unable
  to resolve service for type 'ImOnTech.Teftis.DAL.Dapper.IDbContext'
  while attempting to activate
  'ImOnTech.Teftis.DAL.Repositories.DT_Inspection.CityRepository'.)
  (Error while validating the service descriptor 'ServiceType:
  ImOnTech.Teftis.DAL.IUnitOfWork Lifetime: Transient
  ImplementationType: ImOnTech.Teftis.DAL.UnitOfWork': Unable to resolve
  service for type 'ImOnTech.Teftis.DAL.Dapper.IDbContext' while
  attempting to activate
  'ImOnTech.Teftis.DAL.Repositories.DT_Inspection.CityRepository'.)'&quot;</p>
  </blockquote>
  <p>DapperContext.cs</p>
  <pre><code>namespace ImOnTech.Teftis.DAL.Dapper
  {
      public class DapperContext : IDbContext
      {
          private readonly string _connectionString;
          private IDbConnection _connection;
  
          private readonly IConfiguration configuration;
  
          public DapperContext(IConfiguration _configuration)
          {
              configuration = _configuration;
              _connectionString = configuration.GetConnectionString(&quot;DefaultConnection&quot;);
          }
  
          public void Dispose()
          {
              if (_connection != null &amp;&amp; _connection.State == ConnectionState.Open)
                  _connection.Close();
          }
  
          public IDbConnection Connection
          {
              get
              {
                  if (_connection == null)
                  {
                      _connection = new SqlConnection(_connectionString);
                  }
                  if (_connection.State != ConnectionState.Open) _connection.Open();
                  return _connection;
              }
          }
      }
  }
  </code></pre>
  <p>This is the CityRepository</p>
  <pre><code>public class CityRepository : ICityRepository
  {
      public IDbContext Context { get; }
      public CityRepository(IDbContext context)
      {
          Context = context;
      }       
     
  
      public async Task&lt;IReadOnlyList&lt;City&gt;&gt; GetAllAsync()
      {
          var CityList = await Context.Connection.GetListAsync&lt;City&gt;();
          Context.Connection.Close();
          return CityList.ToList();
          // var sql = &quot;SELECT * FROM [DT_Inspection].City&quot;;
          //using (var connection = new SqlConnection(configuration.GetConnectionString(&quot;DefaultConnection&quot;)))
          //{
          //    connection.Open();
          //    var result = await connection.QueryAsync&lt;City&gt;(sql);
          //    return result.ToList();
          //}
      }
  </code></pre>
  <p>And finally, CityController</p>
  <pre><code> public class CityController : ControllerBase
  {
      private readonly IUnitOfWork unitOfWork;
     
  
      private readonly ILogger&lt;CityController&gt; _logger;
  
      public CityController(ILogger&lt;CityController&gt; logger, IUnitOfWork unitOfWork)
      {
          _logger = logger;
          this.unitOfWork = unitOfWork;
      }
            
    
      [HttpGet]
      public async Task&lt;IActionResult&gt; GetAll()
      {
          var data = await unitOfWork.Cities.GetAllAsync();
          return Ok(data);
      }
  }
  </code></pre>
  <p>P.S. :</p>
  <pre><code>services.AddTransient&lt;ICityRepository, CityRepository&gt;();
          services.AddTransient&lt;IUnitOfWork, UnitOfWork&gt;();
  </code></pre>
  <p>I add them into startup.cs already but didn't work.</p>