title: dependency injection and ado.net and asp.net MVC
body: <p>I have been learning DI and i have implemented something but i want to be sure if my implementation meets or not the DI rules:</p>
  
  <p>an interface with a signiture :</p>
  
  <pre><code> public interface IDashboardRepository
  {
  
     public object sumAndAVG(string regionalManager, string dtFrom, string dtTo);
  }
  </code></pre>
  
  <p>a class to implement the interface signature :</p>
  
  <pre><code>        public class DashboardRepo:IDashboardRepository
          {
  
              private string cn = System.Configuration.ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString;
              NpgsqlConnection con = null;
              public object sumAndAVG(string regionalManager, string dtFrom, string dtTo)
              {
                  DataTable dt_sumProAval = new DataTable();
                  NpgsqlDataAdapter SumOfProduction = new NpgsqlDataAdapter(@"TheSQL is here since its long not part of the topic i removed it", cn);
                  SumOfProduction.Fill(dt_production);
                  var sumAndAvail = (from DataRow dr in dt_production.Rows
                                     select new AverageSumViewModel
  
                                     {
                                        avg = Convert.ToDouble(dr["avalability"] == DBNull.Value ? 0.0 : dr["avalability"]),
                                     }).ToList();
  
                  return sumAndAvail;
              }
          }
  </code></pre>
  
  <p>At the end in my controller i use it like:</p>
  
  <pre><code>  _idashboard.sumAndAVG( regionalManager,  dtFrom,  dtTo);
  </code></pre>
  
  <p>please tell me if im in a right direction</p>