更新时间:2023-02-02 22:41:30
好的.这就是我要做的.首先,在 C# 中组成集合中的序列及其父/子关系.但我会将其放在不同的列中,可能类似于 BatchPartId
和 BatchParentPartId
.(可能是不同的关联表.没关系.)
Ok. Here's what I would do. First, make up the sequence in your collection in C# along with it's parent/child relationship. But I would put that in a different column, maybe something like BatchPartId
and BatchParentPartId
. (Maybe a different associated table. It doesn't matter.)
| PartId | ParentPartId | BatchPartId | BatchParentPartId |
|--------|--------------|-------------|-------------------|
| | | XX1901 | |
| | | XX1902 | XX1901 |
| | | XX1903 | XX1901 |
| | | XX1904 | XX1903 |
| | | XX1905 | XX1903 |
然后,插入整个列表,创建 PartId
.
Then, insert the entire list, allowing the PartId
to get created.
| PartId | ParentPartId | BatchPartId | BatchParentPartId |
|--------|--------------|-------------|-------------------|
| 55 | | XX1901 | |
| 56 | | XX1902 | XX1901 |
| 57 | | XX1903 | XX1901 |
| 58 | | XX1904 | XX1903 |
| 59 | | XX1905 | XX1903 |
在发布时,这是您使用 BatchParentPartId 中相应的
子行.BatchPartId
行的 PartId
填写 ParentPartId
的地方
At post, this is where you fill in the ParentPartId
with the PartId
of the row with the corresponding BatchPartId
from BatchParentPartId
of the child row.
| PartId | ParentPartId | BatchPartId | BatchParentPartId |
|--------|--------------|-------------|-------------------|
| 55 | | XX1901 | |
| 56 | 55 | XX1902 | XX1901 |
| 57 | 55 | XX1903 | XX1901 |
| 58 | 57 | XX1904 | XX1903 |
| 59 | 57 | XX1905 | XX1903 |