views:

14

answers:

1

Hi everyone,

I am playing around with the membership database and have a question. Lets say I have a company called company ABC. There are 10 branches that belong to comapany ABC.

IS there anyway to create a relationship within the database using company ABC as the parent and having the 10 branches as childs?

I hope that makes sense :)

+1  A: 

You can extend the membership database and write your own provider etc look here

However that is a big pain, and if i understand what your after then a waste of effort.

Am I right in thinking you want to link users in the membership database to uses within your own data, and therefore would like to add extra tables (company, branch, user) etc?

If so, just roll a second database with your custom tables. In the user table of your own database store the unique membership username and use this to link to the two in your buisness logic.

Eg, if you need to get the membership roles for every user in Branch X.

a)Get all users in Branch X from your custom database
b)Iterate over them all, using a call to Membership to get the user and their roles.

Or, for the current logged in user get their company. Get the current logged in username, use that to get the user from your DB and get their branch and company etc.

Two poor examples, i know, but hope that helps.

TL;DR use your own database alongside the membership one, storing the membership username of each user in your database too. Merging the two isnt worth the hassle in most cases.

Jammin