2 Replies - 4664 Views - Last Post: 16 May 2009 - 08:31 AM Rate Topic: -----

#1 papuccino1   User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Where in my solution should I create my Database (.mdf) file in?

Post icon  Posted 15 May 2009 - 06:56 PM

Here's a pic of my solution tree:

Posted Image


Should I create the .mdf file in the Presentation Layer of the program or in the Data Access Layer?

The point of my Data Access Layer is so I can just copy the .dll library to any other projects I may have and easily connect to a database by simply modifying the connection string in the app.config file.

Thanks for the help.

Is This A Good Question/Topic? 0
  • +

Replies To: Where in my solution should I create my Database (.mdf) file in?

#2 Jayman   User is offline

  • Student of Life
  • member icon

Reputation: 423
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Where in my solution should I create my Database (.mdf) file in?

Posted 15 May 2009 - 08:12 PM

Neither. The database should be separate from all the layers. The Data Access layer should contain all the methods/functions to handle all the database operations, but not contain the database.

An N-Tier application has technically 4 tiers: Presentation, Business Logic, Data Access, and Database.

Store the database in another location and just set the connection string in the app.config file. Preferably you should have the database on a separate server from your application.

But if you are going to store it in a layer, then put it in the Data Access layer.
Was This Post Helpful? 0
  • +
  • -

#3 eclipsed4utoo   User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1535
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Where in my solution should I create my Database (.mdf) file in?

Posted 16 May 2009 - 08:31 AM

Do not add the database to your solution. You don't need to. Just setup the SQL Server instance, then use a connection string.

For a service-based database, you don't need to have it added to your project. I really don't understand why Microsoft added this to VS2008. Seems to just cause more confusion.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1