Skip to content

Commit e2f23ef

Browse files
Having clear example of how to work on 6.2.0
1 parent 250409f commit e2f23ef

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

migration-guide 5.2.4 to 6.2.0.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -296,26 +296,27 @@ var exchangeId = someExchangeData.ExchangeID;
296296
var exchangeId = elementDataModel.ExchangeID;
297297
```
298298

299-
### 2. **Mixing Old and New Patterns**
300-
**Problem:** Using both `ExchangeData` and `ElementDataModel` in the same workflow
299+
### 2. **Attempting to Use ExchangeData (Compilation Error)**
300+
**Problem:** Trying to use `ExchangeData` which is no longer accessible
301301
```csharp
302-
//Mixed pattern - avoid this
302+
//This will cause COMPILATION ERROR in 6.2.0
303303
ExchangeData exchangeData = await Client.GetExchangeDataAsync(identifier);
304304
ElementDataModel model = ElementDataModel.Create(Client, exchangeData);
305305
```
306-
**Solution:** Use `ElementDataModel` consistently
306+
**Solution:** Use `ElementDataModel` directly - it's the only option
307307
```csharp
308-
//Consistent pattern
308+
//Only working pattern in 6.2.0
309309
ElementDataModel model = await Client.GetElementDataModelAsync(identifier);
310310
```
311311

312312
### 3. **Deprecated Method Usage**
313313
**Problem:** Using deprecated methods that return `ExchangeData`
314314
```csharp
315-
//May be deprecated
315+
//These methods DO NOT EXIST in 6.2.0 - compilation error
316316
var data = Client.GetExchangeDataSync(identifier);
317+
var asyncData = await Client.GetExchangeDataAsync(identifier);
317318
```
318-
**Solution:** Use new async methods that return `ElementDataModel`
319+
**Solution:** Use only the available `ElementDataModel` methods
319320
```csharp
320321
// ✅ Use new methods
321322
var data = await Client.GetElementDataModelAsync(identifier);
@@ -324,7 +325,7 @@ var data = await Client.GetElementDataModelAsync(identifier);
324325
### 4. **Event Handler Updates**
325326
**Problem:** Event handlers expecting `ExchangeData` parameters
326327
```csharp
327-
//Old event signature
328+
//This will cause compilation error - ExchangeData not accessible
328329
public void OnExchangeUpdated(ExchangeData data) { ... }
329330
```
330331
**Solution:** Update to expect `ElementDataModel`
@@ -333,16 +334,38 @@ public void OnExchangeUpdated(ExchangeData data) { ... }
333334
public void OnExchangeUpdated(ElementDataModel model) { ... }
334335
```
335336

336-
### 5. **Null Reference Errors**
337-
**Problem:** Assuming `ExchangeData` properties are available
337+
### 5. **Accessing ExchangeData Properties Through ElementDataModel**
338+
**Problem:** In 5.2.4, you could access `ExchangeData` properties through the `ElementDataModel` wrapper
338339
```csharp
339-
// ❌ May cause null reference
340-
var id = elementDataModel.ExchangeData.ExchangeID;
340+
// ❌ This pattern worked in 5.2.4 but causes compilation error in 6.2.0
341+
var elementModel = ElementDataModel.Create(Client, exchangeData);
342+
var id = elementModel.ExchangeData.ExchangeID;
343+
var rootAsset = elementModel.ExchangeData.RootAsset;
341344
```
342-
**Solution:** Use direct `ElementDataModel` properties
345+
**Solution:** Access these properties from the appropriate source objects
343346
```csharp
344-
// ✅ Direct access
345-
var id = elementDataModel.ExchangeID;
347+
// ✅ Get ExchangeID from ExchangeItem
348+
var id = exchangeItem.ExchangeID;
349+
350+
// ✅ Access RootAsset and other properties through ElementDataModel methods
351+
// (Check ElementDataModel API documentation for available methods)
352+
```
353+
354+
### 6. **Creating DataExchangeIdentifier**
355+
**Problem:** Need to create `DataExchangeIdentifier` for API calls but don't know where to get the values
356+
```csharp
357+
// ❌ In 5.2.4, you might have tried to get this from ExchangeData
358+
var identifier = someExchangeData.ExchangeIdentifier; // This property doesn't exist
359+
```
360+
**Solution:** Create `DataExchangeIdentifier` manually from `ExchangeItem` properties
361+
```csharp
362+
// ✅ Standard pattern used throughout 6.2.0 codebase
363+
var identifier = new DataExchangeIdentifier
364+
{
365+
ExchangeId = exchangeItem.ExchangeID,
366+
CollectionId = exchangeItem.ContainerID,
367+
HubId = exchangeItem.HubId,
368+
};
346369
```
347370

348371
---

0 commit comments

Comments
 (0)