Foreign keys using LINQ to SQL

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top