0

I am taking a 1st attempt at creating a reuable multi tier application.

I have created a Data Access layer project which is referenced by a business layer project. I created a website that references the business layer project and plan to use this in many other website.

I have dropped the complied business layer project dll into the website bin folder and done a file reference. When I make a call to the business layer it throws a cannot load Data Access assembly. To solve this I drop the Data Access dll into the website bin folder and everything works.

In the future I expect the Business Layer to make many references to different projects so I expect to be adding all project dlls that the Business Layer references into the bin folder for each website. Is this the correct way I am doing this or is there a simplified approach to this?

Kogroth
  • 87
  • 1
  • 2
  • 8
  • Why don't you set up the reference to the Data Access layer project DLL instead of dropping the DLL in the Business Layer's bin folder? The compiler should handle the shuffling around of the DLL files for you that way. – itsme86 Feb 07 '17 at 00:19
  • Ideally, you should not need to "drop" anything. Everything should build to atomic setup – T.S. Feb 07 '17 at 00:24

2 Answers2

0

Create a folder, say BusinessLayer. Create Subfolders inside this folder. Create class libraries inside these folders and create namespaces that are reflected in the folder names. Do the same for, say Data Access and View Layers. Reference data access namespaces in Business Layer and the business layer namespaces in the View layers. Make sure that the Data Access Layer talks to the Business Layer via an interface if possible. The API website/app etc could sit on top of these 3 layers.

Nothing
  • 99
  • 12
0

There are 2 ways you can handle this

1) Add project reference.

Click add reference on web project -> click Projects options -> click solution -> check business layer.

You need to do same on business layer to add data layer project reference.

2) Seconds approach is using nuget packages. You can create nuget package for csproj to be shared. This is approach is very useful when you sharing dlls across multiple projects and need version control between different projects. Command to create nuget package from csproj.

nuget pack BusinessLayer.csproj
Kaushal
  • 1,251
  • 1
  • 8
  • 8
  • Thanks. I have looked into using NuGet package explorer to create a package to store in a shared repository. – Kogroth Feb 07 '17 at 17:04