title: Removing Data Access layer coupling from user interface
body: <p>Currently my application's UI layer is coupled to my DAL dll. Dal is initialized like this:</p>
  
  <pre><code>//Initialize Data Access for AS400
  Dal = JDE8Dal.Instance;
  Dal.conString = Properties.Settings.Default.conAS400;
  </code></pre>
  
  <p>DAL is desinged as singleton. I thought that forcing the application to have one instance is a good idea.</p>
  
  <p>DAL:</p>
  
  <pre><code>public class JDE8Dal
      {
          public string conString { get; set; }
          private static readonly JDE8Dal _instance = new JDE8Dal();
          private JDE8Dal()
          {
          }
          public static JDE8Dal Instance
          {
              get { return _instance; }
          }
          // Methods
      }
  </code></pre>
  
  <p>My BLL will look something like this:</p>
  
  <pre><code>namespace YLA.Barcode
  {
      public static class YlaBarcodeUtil
      {
          public static string LotStripZeroes(string str)
          {
              var ret = str;
              if (str.Trim().StartsWith("00"))
              {
                  ret = YlaGeneralUtilities.StripLeadingNumofChars(str, 2);
              }
              return ret;
          }
      }
  
  public class BarcodeBLL
  {
      //DAL INIT HERE?
  }
  }
  </code></pre>
  
  <p>Now that i need to build more applications i need to move into a 3 layer architecture and start reading on DDD.</p>
  
  <p>1) How to move the DAL handling in BLL? Just add the initialization in my BLL section?</p>
  
  <p>2) Should i keep my DAL design as singleton or not?</p>