0

in my web site i have two databases, ASPNETDB.MDF and a self created one (database.mdf). (The don't contain a lot of data yet) But i need a relationship (foreign key) between a table in ASPNETDB.MDF and a table in database.mdf.

So i guess i need to merge both databases first, would you just extend the "ASPNETDB.MDF" with the tables from "database.mdf" ? or better configure "database.mdf" for the asp.net Applicatoin Services and then delete "ASPNETDB.MDF" ? Is "ASPNETDB.MDF" even meant to be used in a production online web application?

(Right now i'm using sql server express but i will probably use sql server when deploying Site to a shared host)

thanks a lot for answers

2 Answers2

0

the scripts for the structure that is inside ASPNETDB.MDF are deployable on a different database (http://msdn.microsoft.com/en-us/library/x28wfk74.aspx)

however, I would really consider wether or not you want to do a foreign key to those tables, the membership, roles and profile API is intended to be used as a pluggable API, something you will break by defining your foreign key

Tim Mahy
  • 1,319
  • 12
  • 28
  • 1
    Thanks for the answer, but if i dont do a foreign key to those tables, how would you implement a relatioship to an logged in user ? for exc. in my site users can write product reviews, so in my reviews table i have a column "UserId" that i wanted to point to the column "UserId" (table "aspnet_Users" from ASPNETDB.MDF) to implement a relationship... – ibmkahm Oct 25 '10 at 11:05
  • I would combine the ProviderName / ProviderUserKey from the MembershipUser class – Tim Mahy Oct 25 '10 at 11:52
0

Setting up membership in existing database is something you should be looking at. If you are asking me, I will and I have created membership related data objects in my application specific database. You can find the SQL scripts to do so at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727(v4.0.30319 in case you have VS 2010).

By doing this you can create foreign keys to membership table and achieve your objective.

Community
  • 1
  • 1
Pradeep
  • 3,258
  • 1
  • 23
  • 36