Customize Visual Studio XSD Generation Rules

138 views Asked by At

I'm generating my XSDs by drag-and-dropping the tables onto the XSD Design view in Visual Studio 2019. For the most part this is generating what I need, however I've noticed there's an issue, it's not generating my foreign keys as foreign keys but as relationships, which means ON CASCADE DELETE isn't working. Is there a way to run the tool, either through the GUI or command line, that generates my foreign keys as foreign keys with cascading deletes intact?

1

There are 1 answers

1
Jingmiao Xu-MSFT On

If you want to generate your foreign keys as foreign keys with cascading deletes intact, you can refer to the under steps:

First, right click on XMLSchema.xsd file and choose Open With… enter image description here

Second, choose DataSet Editor. enter image description here

Then, right click on the table choose Add-->Relation. enter image description here

Finally you can change your foreign key and modify the deletion rules in the lowed part. enter image description here