Note that there are some explanatory texts on larger screens.

plurals
  1. PON-Tier Architecture - Structure with multiple projects in VB.NET
    primarykey
    data
    text
    <p>I would like some advice on the best approach to use in the following situation...</p> <p>I will have a Windows Application and a Web Application (presentation layers), these will both access a common business layer. The business layer will look at a configuration file to find the name of the dll (data layer) which it will create a reference to at runtime (is this the best approach?).</p> <p>The reason for creating the reference at runtime to the data access layer is because the application will interface with a different 3rd party accounting system depending on what the client is using. So I would have a separate data access layer to support each accounting system. These could be separate setup projects, each client would use one or the other, they wouldn't need to switch between the two.</p> <p><strong>Projects:</strong></p> <p><em>MyCompany.Common.dll</em> - Contains interfaces, all other projects have a reference to this one.<br> <em>MyCompany.Windows.dll</em> - Windows Forms Project, references MyCompany.Business.dll<br> <em>MyCompany.Web.dll</em> - Website project, references MyCompany.Business.dll<br> <em>MyCompany.Busniess.dll</em> - Business Layer, references MyCompany.Data.* (at runtime)<br> <em>MyCompany.Data.AccountingSys1.dll</em> - Data layer for accounting system 1 <em>MyCompany.Data.AccountingSys2.dll</em> - Data layer for accounting system 2</p> <p>The project <strong>MyCompany.Common.dll</strong> would contain all the interfaces, each other project would have a reference to this one.</p> <pre><code>Public Interface ICompany ReadOnly Property Id() as Integer Property Name() as String Sub Save() End Interface Public Interface ICompanyFactory Function CreateCompany() as ICompany End Interface </code></pre> <p>The project <strong>MyCompany.Data.AccountingSys1.dll</strong> and <strong>MyCompany.Data.AccountingSys2.dll</strong> would contain the classes like the following:</p> <pre><code>Public Class Company Implements ICompany Protected _id As Integer Protected _name As String Public ReadOnly Property Id As Integer Implements MyCompany.Common.ICompany.Id Get Return _id End Get End Property Public Property Name As String Implements MyCompany.Common.ICompany.Name Get Return _name End Get Set(ByVal value as String) _name = value End Set End Property Public Sub Save() Implements MyCompany.Common.ICompany.Save Throw New NotImplementedException() End Sub End Class Public Class CompanyFactory Implements ICompanyFactory Public Function CreateCompany() As ICompany Implements MyCompany.Common.ICompanyFactory.CreateCompany Return New Company() End Function End Class </code></pre> <p>The project <strong>MyCompany.Business.dll</strong> would provide the business rules and retrieve data form the data layer:</p> <pre><code>Public Class Companies Public Shared Function CreateCompany() As ICompany Dim factory as New MyCompany.Data.CompanyFactory Return factory.CreateCompany() End Function End Class </code></pre> <p>Any opinions/suggestions would be greatly appreciated.</p>
    singulars
    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.
 

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