Last post May 16, 2011 02:26 PM by atconway
May 14, 2011 05:36 AM|sephiroth100|LINK
I have a c# web solution that until recently had a single project. I want to add a 2nd project.
At present the dtabase associated with project 1 is in the app_data folder of project 1.
The 2nd project also needs to use the resources of project 1 - how do I go about structuring this?
May 14, 2011 06:34 AM|saedshaar1|LINK
In Visual Studio, Select File -- Add -- New Project.
May 14, 2011 07:40 AM|sephiroth100|LINK
Can Ireference the database though?
May 15, 2011 06:35 PM|saedshaar1|LINK
May 16, 2011 02:26 PM|atconway|LINK
Typically the layer that contains the App_Data folder is the UI layer, and I don't like to have projects need a reference to it (start to get into cyclical references). Rather I prefer the UI layer to require the references of layers below it.
I think it might be possible to extract out the database file in your App_Code, place it in a class library project that has Data Access (DAL) type behavior and then have your UI web app layer reference this new layer. The problem is I have always
found it to be a bit tricky making any other file types besides other .dlls be referenced and dependencies of a class library project and get successfully output when building. I prefer the single binary to be the output when creating a class library project if
I am not savvy to the nth degree on local (i.e. SQL Compact) databases within the web app (more familiar with full on SQL databases), and there might be layering guidelines specific to this setup. If there is non-data access logic and not associated with
needing access to that database, then that type of code could easily be refactored into a class library on its own referenced by the UI layer. However if it was me in the scenario you are describing, I would probably leave the database where it was
and just refactor the newly needed code into their own set of classes within the same layer.