HighTechTalks DotNet Forums  

Questions About Relationships

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Questions About Relationships in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jonathan Wood
 
Posts: n/a

Default Questions About Relationships - 12-30-2007 , 05:40 PM






I'm using the ASP.NET membership routines but had to create some of my own
tables to store additional user information (profiles won't work for me).

So far, so good. But it seems like I should really create a relationship
between the membership table aspnet_Membership and my own table in order to
have the database enforce the relationship, and, ideally, to also implement
automatically cascading deletes to avoid orphaned records in my own tables.

So I created a foreign key in my own table, and set up a relationship with
the UserId field in aspnet_Membership. But I'm new to this and I notice that
this makes a change to the aspnet_Membership table (VS tells me both tables
need to be saved).

I'm a little uncomfortable making changes to the existing tables. I'm not
completely certain I've set up the relationship correctly and would hate to
disable the membership tables and also I wonder about what happens if the
membership tables must be recreated for some reasons.

Anyone have any tips for me?

Thanks!

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


Reply With Quote
  #2  
Old   
Cowboy \(Gregory A. Beamer\)
 
Posts: n/a

Default Re: Questions About Relationships - 12-31-2007 , 10:52 AM






This is a "Feature" of the management studio and a primary reason I consider
it verbotten for changes on production systems.

You can script out the changes instead and strip out the portions that dink
with the ASPNET_Membership table or you can write the foreign key yourself,
if you like typing SQL. It is unlikely the changes to ASPNET_Membership will
cause you any harm, but there is no reason to alter it.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
Quote:
Think outside the box!

*************************************************
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote

Quote:
I'm using the ASP.NET membership routines but had to create some of my own
tables to store additional user information (profiles won't work for me).

So far, so good. But it seems like I should really create a relationship
between the membership table aspnet_Membership and my own table in order
to have the database enforce the relationship, and, ideally, to also
implement automatically cascading deletes to avoid orphaned records in my
own tables.

So I created a foreign key in my own table, and set up a relationship with
the UserId field in aspnet_Membership. But I'm new to this and I notice
that this makes a change to the aspnet_Membership table (VS tells me both
tables need to be saved).

I'm a little uncomfortable making changes to the existing tables. I'm not
completely certain I've set up the relationship correctly and would hate
to disable the membership tables and also I wonder about what happens if
the membership tables must be recreated for some reasons.

Anyone have any tips for me?

Thanks!

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com




Reply With Quote
  #3  
Old   
Jonathan Wood
 
Posts: n/a

Default Re: Questions About Relationships - 12-31-2007 , 05:16 PM



Cowboy,

Quote:
This is a "Feature" of the management studio and a primary reason I
consider it verbotten for changes on production systems.
Not 100% clear on what is the "Feature." The fact that the relationship
requires changing the original table?

Quote:
You can script out the changes instead and strip out the portions that
dink with the ASPNET_Membership table or you can write the foreign key
yourself, if you like typing SQL. It is unlikely the changes to
ASPNET_Membership will cause you any harm, but there is no reason to alter
it.
Hmm... I think you've lost me completely there. What would these scripts do.
The only think that seems to be changing the membership table is
establishing the relationship. I don't see that as something that I can
eliminate with scripts. I could write scripts to perform cascading updates
and deletes--could that be what you mean?

Thanks.

Quote:
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:uRRDy1zSIHA.4272 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
I'm using the ASP.NET membership routines but had to create some of my
own tables to store additional user information (profiles won't work for
me).

So far, so good. But it seems like I should really create a relationship
between the membership table aspnet_Membership and my own table in order
to have the database enforce the relationship, and, ideally, to also
implement automatically cascading deletes to avoid orphaned records in my
own tables.

So I created a foreign key in my own table, and set up a relationship
with the UserId field in aspnet_Membership. But I'm new to this and I
notice that this makes a change to the aspnet_Membership table (VS tells
me both tables need to be saved).

I'm a little uncomfortable making changes to the existing tables. I'm not
completely certain I've set up the relationship correctly and would hate
to disable the membership tables and also I wonder about what happens if
the membership tables must be recreated for some reasons.

Anyone have any tips for me?

Thanks!

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com



--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.