|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import { Id64String, JsonUtils } from "@itwin/core-bentley"; |
10 | | -import { _implicitTxn, EditTxn, ElementMultiAspect, IModelDb } from "@itwin/core-backend"; |
| 10 | +import { EditTxn, ElementMultiAspect, IModelDb } from "@itwin/core-backend"; |
11 | 11 | import { RelatedElement } from "@itwin/core-common"; |
12 | 12 | import { |
13 | 13 | DistanceExpressionProps, LinearlyReferencedAtLocationAspectProps, LinearlyReferencedFromToLocationAspectProps, |
@@ -89,8 +89,13 @@ export class LinearlyReferencedAtLocation extends LinearlyReferencedLocation { |
89 | 89 |
|
90 | 90 | public static insert(txnOrIModel: EditTxn | IModelDb, locatedElementId: Id64String, |
91 | 91 | at: DistanceExpression, fromReferentId?: Id64String): void { |
92 | | - const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn]; |
93 | | - txn.insertAspect(this.toProps(locatedElementId, at, fromReferentId)); |
| 92 | + const aspectProps = this.toProps(locatedElementId, at, fromReferentId); |
| 93 | + if (txnOrIModel instanceof EditTxn) |
| 94 | + txnOrIModel.insertAspect(aspectProps); |
| 95 | + else { |
| 96 | + // eslint-disable-next-line @typescript-eslint/no-deprecated -- deprecated IModelDb overload is intentionally preserved for backward compatibility. |
| 97 | + txnOrIModel.elements.insertAspect(aspectProps); |
| 98 | + } |
94 | 99 | } |
95 | 100 | } |
96 | 101 |
|
@@ -147,7 +152,12 @@ export class LinearlyReferencedFromToLocation extends LinearlyReferencedLocation |
147 | 152 |
|
148 | 153 | public static insert(txnOrIModel: EditTxn | IModelDb, locatedElementId: Id64String, |
149 | 154 | from: DistanceExpression, to: DistanceExpression, fromReferentId?: Id64String, toReferentId?: Id64String): void { |
150 | | - const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn]; |
151 | | - txn.insertAspect(this.toProps(locatedElementId, from, to, fromReferentId, toReferentId)); |
| 155 | + const aspectProps = this.toProps(locatedElementId, from, to, fromReferentId, toReferentId); |
| 156 | + if (txnOrIModel instanceof EditTxn) |
| 157 | + txnOrIModel.insertAspect(aspectProps); |
| 158 | + else { |
| 159 | + // eslint-disable-next-line @typescript-eslint/no-deprecated -- deprecated IModelDb overload is intentionally preserved for backward compatibility. |
| 160 | + txnOrIModel.elements.insertAspect(aspectProps); |
| 161 | + } |
152 | 162 | } |
153 | 163 | } |
0 commit comments