Foreign keys using LINQ to SQL

  • Thread starter Thread starter r norman
  • Start date Start date
R

r norman

Is there some way in .NET (3.5) to specify that my SQL server foreign
links should use declarative referential integrity ("ON DELETE
CASCADE")?

My application is developed in C# for .NET 3.5 using LINQ to SQL
where my database tables are linked with foreign key associations. The
database is designed using the LINQ to SQL graphics designer (dbml).
The "Edit Association" properties in the database designer do not seem
to include foreign key constraints.

Do I have to write specific code for each foreign key using T_SQL to
"ALTER TABLE .. ADD CONSTRAINT"? If so, is there an easy way to cycle
through each table in the database and find the foreign keys
programmatically?
 
Back
Top