Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Don't pass the connection string in the BO layer. Instead use an indentifier and then a factory in your DAL layer to go and get the connection string/DAL.</p> <p>For example, DAL Dll config file:</p> <pre><code>&lt;Connections&gt; &lt;connection name="test" connectionString="Data Source=####\SQL2008;Initial Catalog=test;User Id=####;Password=####;" providerName="System.Data.SqlClient"&gt;test&lt;/connection&gt; &lt;connection name="test2" connectionString="Data Source=####\SQL2008;Initial Catalog=test2;User Id=####;Password=####;" providerName="System.Data.SqlClient"&gt;test2&lt;/connection&gt; &lt;/Connections&gt; </code></pre> <p>When a client logs in to your application, give them a drop down of available connections (or hide it via a config file if you don't want users choosing the connection) and then use that to factory out a database connection.</p> <p>The objects that are passed between layers would have this identifier. Use the identifer to create the DAL conneciton.</p> <p>Sample data transfer object that could be passed between layers (with identifier):</p> <pre><code> /// &lt;summary&gt; /// A data transfer object is sent between layers. It has a few base properties /// as well as a list of payload objects. /// &lt;/summary&gt; [DataContract(Namespace= SharedModelNamespace.Namespace.SharedModel)] public class DataTransferObject { /// &lt;summary&gt; /// As part of the data transfer object, it specifies what environment to connect /// to should it make a DAL call. /// &lt;/summary&gt; [DataMember] public string DataEnvironment {get; set }; /// &lt;summary&gt; /// These are the list of objects (the payload) that will be transferred /// back and forth from the server to the client. /// &lt;/summary&gt; [DataMember] public List&lt;BasePOCO&gt; DataTransferObjects { get; set; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload