This isn't a direct answer to your question, but it's entirely possible to have a one-to-many relationship in a .dbml
file. See the screenshot below, which is simply the properties sidebar you can get to by right-clicking on an association and choosing "Properties".
Is it possible to create DataRelation 1:1 in c#?
-
06-03-2022 - |
Question
In my app I use ORM Designer which supports only 1:1 relation. I have Items, Products, Shipping tables: Item has ProductId and ShippingId attributes which are foreign keys.
I need to upload data from xml file into my SQL DB, so I gonna use SqlBulkCopy class and I need to create DataTable objects: itemsTable, productsTable, shippingTable to load data from xml into them.
So, do I need to create DataRelations: ItemsProducts and ItemsShipping? If so, itemsTable would contain productsTable and shippingTable?
Thanks!
Edits:
And is it possible to write to server the content from 3 dataTables simultaneously?
Solution
OTHER TIPS
If you use SqlBulkCopy
, you have to do it using one table/entity at a time. It will work if the entities already have the foreign key values. BTW I created a wrapper object for SqlBulkCopy
that can do a bulk insert for a collection of objects.
It may help you, you can find it here:
http://www.codeproject.com/Articles/354094/Bulk-Insert-in-NET-applications-Part-1