views:

55

answers:

1

I'm building a web application in ASP.NET and I want to separate it into three layers: Presentation, Data and Business.

I want to keep my database in the Data layer but I can't figure out a way to do that with the ASP.NET Memberships database (ASPNETDB.mdf).

Is there any way to tell the site to reference a database file in another project?

A: 

You can't reference the DB in another project to my knowledge. If your DB was in SQL Server instead of in the app_data you could call it from any project....

You can create/recreate the database using the aspnet_regsql.exe if needed.

Since you are wanting to tier you should look at having the presentation tier call the business tier to authenticate which calls the data tier ultimately to check authentication and rights. If you do this then the presentation tier won't need a reference to the DB.

klabranche
Thanks for the response. I must be doing something wrong then because I tried using a DB in SQL Server and couldn't get the application to use that one. It kept looking for one in App_Data. Is there a connection string I have to enter in web.config or something?
Carl
add a connection string to the web.config to your DB and point your controls at it. However, if you are trying to tier then in the long run you wouldn't want the presentation tier to reference the DB. But for testing give it a shot.
klabranche
Thanks again. I got it working with your help.
Carl
Awesome! Glad to help!
klabranche