WSupplies* pSupplies = NULL; WInventory* pInventory = NULL; DataFS::stcObjectLink* pInventoryLink; if(S_OK == pDomain->QueryNamedLink(&guidEntryPoint, 1, &pInventoryLink, NULL)) { if(WInventory::IsOfType(pInventoryLink)) { WInventory::Open(&pInventory, pDomain, *pInventoryLink); pInventory->Load(); DataFSAccess::MemFree(pInventoryLink); if(FAILED(pDomain->Execute(Transaction::Load, NULL))) { wprintf(L"Execute failed...\n"); uninit(pConnection, pDomain, ulStorageId); return -1; } pSupplies = WSupplies::CastTo(pInventory->GetObject()); } else if(WSupplies::IsOfType(pInventoryLink)) { DataFSAccess::MemFree(pInventoryLink); wprintf(L"Object is not of type WInventory but of type WSupplies\n"); } else { DataFSAccess::MemFree(pInventoryLink); wprintf(L"Object is not of type WInventory\n"); } } else { WInventory::Create(&pInventory, pDomain, &DataFS::OBJECTID_NULL); pDomain->InsertNamedLink(&pInventory->BuildLink(true), &guidEntryPoint, L"extended entry point"); pSupplies = WSupplies::CastTo(pInventory->GetObject()); // Store pInventory->Store(); // Execute HRESULT hRes; if(FAILED(hRes = pDomain->Execute(Transaction::Store, NULL))) { wprintf(L"Domain failed to execute the transaction (0x%x)\n", hRes); pSupplies->Release(); pSupplies = NULL; } }
WSupplies
NULL
WInventory
stcObjectLink
if
S_OK
FAILED
Transaction
"Execute failed...\n"
return
else
"Object is not of type WInventory but of type WSupplies\n"
"Object is not of type WInventory\n"
true
"extended entry point"
// Store
// Execute
HRESULT
"Domain failed to execute the transaction (0x%x)\n"
WSupplies pSupplies = null; WInventory pInventory = null; DataFS.Array<DataFS.stcObjectLink> apInventoryLink = new DataFS.Array<DataFS.stcObjectLink>(); if (0 == pDomain.QueryNamedLink(aguidEntryPoint, apInventoryLink, null)) { if (WInventory.IsOfType(apInventoryLink.pData[0])) { WInventory.Open(out pInventory, pDomain, apInventoryLink.pData[0].oiObjectId, 0, Transaction.Load); pInventory.Load(_WInventory.ALL_ATTRIBUTES, Transaction.Load); if (0 > pDomain.Execute(Transaction.Load, null)) { Console.WriteLine("Execute failed..."); uninit(pDomain, ulStorageId); return; } pSupplies = WSupplies.CastTo(pInventory.GetObject()); } else if (WSupplies.IsOfType(apInventoryLink.pData[0])) { Console.WriteLine("Object is not of type WInventory but of type WSupplies"); } else { Console.WriteLine("Object is not of type WInventory"); } } else { WInventory.Create(out pInventory, pDomain, DataFS.ObjectId.OBJECTID_NULL); pDomain.InsertNamedLink(pInventory.BuildLink(true), guidEntryPoint, "extended entry point", Transaction.Store); pSupplies = WSupplies.CastTo(pInventory.GetObject()); // Store pInventory.Store(Transaction.Store); // Execute int hRes; if (0 > (hRes = pDomain.Execute(Transaction.Store, null))) { Console.WriteLine("Domain failed to execute the transaction (0x{0:x})", hRes); pInventory = null; pSupplies = null; } }
null
new
out
"Execute failed..."
"Object is not of type WInventory but of type WSupplies"
"Object is not of type WInventory"
ObjectId
int
"Domain failed to execute the transaction (0x{0:x})"