> Hi,
>
[quoted text clipped - 16 lines]
> column. But i dont want to implement this myself if the sqlclient
> consumer classes can do it.
Relations aren't defined in taht table. You should determine which FK
constraints are defined. Then define a relation between the FK side and
the PK side and vice versa, and add each relation to each side, so the
PK side gets the PK side -> FK side relation and the FK side gets the
FK side -> PK side relation. This is tricky, as you also need to
determine the relation type: m:1/1:n etc. 1:1 are a special case, as
FK+UC also makes a 1:1 relation, so you also have to read the UC
constraints. After you've created those relations, you can define the
m:n relations. Two entities which have both a 1:n relation with a 3rd
entity have a m:n relation via that 3rd entity.
It depends on the db type where the meta-data for constraints is
located: sqlserver 2005 stores it differently than sqlserver 2000/7 for
example. generally you could use a couple of queries on the
INFORMATION_SCHEMA views.
You can also use a 3rd party application to do it all for you of
course :), for example an O/R mapper :)
FB

Signature
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------