1

I am planning to use ASP.NET MVC2 implemented membership system to manage users. Database that uses application should have tables that are related with these users. Is it possible to use two different databases and make relationships (foreign keys) between them or I will have to merge these two databases into one?

Thanks,
Ile

2 Answers 2

3

It is NOT possible to put up relationships between databases. You CAN use triggers to ensure relational integrity.

Otherwise I would say: all in one database, put them into different schemata.

Sign up to request clarification or add additional context in comments.

2 Comments

"You CAN use triggers to ensure relational integrity" - What does this actually mean? Could you please be more precise? Thanks
Well, a trigger (read up the documentation - actually a set of triggers) can be used to enfoce relational integrity. It is properly documented in - the documentation. msdn.microsoft.com/en-us/magazine/cc164047.aspx has an introduction on what triggers are.
0

I would put membership/roles in a separate database. I don't think having foreign key constraints is that useful. Its better decoupling if you go through the membership API rather than join with the tables directly. The only thing in the membership database you might need to look up often is the username. If thats becomes a performance problem I'd probably just create an lookup table, either in memory or in a lookup table in the other component's database.

2 Comments

I there is a need to (for example) log/audit changes against a user identifier or to define "ownership" of data by user how do you reconcile the above? Foreign key constraints are self evidently useful?
Add a column to store the guid the membership provider uses to identify the user. You can write this information to the log whether or not the DB enforces referential integrity.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.