WResponsible* pResponsible; WResponsible::Create(&pResponsible, pInventory);
WResponsible
WResponsible pResponsible; WResponsible.Create(out pResponsible, pInventory);
out
pInventory->LinkResponsible(pResponsible);
pInventory.LinkResponsible(pResponsible);
pResponsible->SetFullName(L"a name"); pResponsible->SetComment(L"an interesting comment");
"a name"
"an interesting comment"
pResponsible.SetFullName("a name"); pResponsible.SetComment("an interesting comment");
pResponsible->Store(); pInventory->Store();
pResponsible.Store(Transaction.Store); pInventory.Store(Transaction.Store);
Transaction
pInventory->GetDomain()->Execute(Transaction::Store);
pInventory.GetDomain().Execute(Transaction.Store);
pResponsible->Release();
WResponsible* pResponsible; pInventory->OpenResponsible(&pResponsible); pResponsible->Load(); pResponsible->GetDomain()->Execute(Transaction::Load);
WResponsible pResponsible; pInventory.OpenResponsible(out pResponsible, Transaction.Load); pResponsible.Load(Transaction.Load); pResponsible.GetDomain().Execute(Transaction.Load);
const wchar_t* strFullName; pResponsible->GetFullName(&strFullName); const wchar_t* strComment; pResponsible->GetComment(&strComment);
const
wchar_t
string strFullName; pResponsible.GetFullName(out strFullName); string strComment; pResponsible.GetFullName(out strComment);
string
#include "pch.h" void writeObject(WInventory* pInventory) { // create object WResponsible* pResponsible; WResponsible::Create(&pResponsible, pInventory); // FullName wprintf(L"Full name:\n"); std::wstring input1; getline(std::wcin, input1); pResponsible->SetFullName(input1.c_str()); // Comment wprintf(L"Comment:\n"); std::wstring input2; getline(std::wcin, input2); pResponsible->SetComment(input2.c_str()); // set objectlink pInventory->LinkManager(pResponsible); // Store pResponsible->Store(); // new object pInventory->Store(); // Execute HRESULT hRes; if(FAILED(hRes = pInventory->GetDomain()->Execute(Transaction::Store))) { wprintf(L"Domain failed to execute the transaction (0x%x)", hRes); } pResponsible->Release(); }
#include
"pch.h"
void
WInventory
// create object
// FullName
"Full name:\n"
wstring
// Comment
"Comment:\n"
// set objectlink
// Store
// new object
// Execute
HRESULT
if
FAILED
"Domain failed to execute the transaction (0x%x)"
using System; using DataFoundationAccess; namespace TutorialCs { partial class Tutorial { public static void writeObject(WInventory pInventory) { // create object WResponsible pResponsible; WResponsible.Create(out pResponsible, pInventory); // FullName Console.WriteLine("Full name:"); string input1 = Console.ReadLine(); pResponsible.SetFullName(input1); // Comment Console.WriteLine("Comment:"); string input2 = Console.ReadLine(); pResponsible.SetComment(input2); // set objectlink pInventory.LinkManager(pResponsible); // Store pResponsible.Store(Transaction.Store); // new object pInventory.Store(Transaction.Store); // Execute int hRes; if(0 > (hRes = pInventory.GetDomain().Execute(Transaction.Store))) { Console.WriteLine("Domain failed to execute the transaction (0x{0:x})", hRes); } pResponsible.Dispose(); } } }
using
namespace
partial
class
Tutorial
public
static
"Full name:"
"Comment:"
int
"Domain failed to execute the transaction (0x{0:x})"
#include "pch.h" void readObject(WInventory* pInventory) { HRESULT hRes; // Open WResponsible* pResponsible; if(S_OK == (hRes = pInventory->OpenManager(&pResponsible))) { // Load pResponsible->Load(); // Execute if(FAILED(hRes = pResponsible->GetDomain()->Execute(Transaction::Load))) { wprintf(L"Domain failed to execute the transaction (0x%x)\n", hRes); } else { // FullName const wchar_t* strFullName; pResponsible->GetFullName(&strFullName); wprintf(L"Responsible full name: %s\n", strFullName); // Comment const wchar_t* strComment; pResponsible->GetComment(&strComment); wprintf(L"Responsible comment: %s\n", strComment); } pResponsible->Release(); } else wprintf(L"Cannot open responsible (0x%x)\n", hRes); }
// Open
S_OK
// Load
"Domain failed to execute the transaction (0x%x)\n"
else
"Responsible full name: %s\n"
"Responsible comment: %s\n"
"Cannot open responsible (0x%x)\n"
using System; using DataFoundationAccess; namespace TutorialCs { partial class Tutorial { public static void readObject(WInventory pInventory) { int hRes; // Open WResponsible pResponsible; if (0 > (hRes = pInventory.OpenManager(out pResponsible, Transaction.Load))) { // Load pResponsible.Load(_WResponsible.ALL_ATTRIBUTES, Transaction.Load); // Execute if (0 > (hRes = pResponsible.GetDomain().Execute(Transaction.Load))) { Console.WriteLine("Domain failed to execute the transaction (0x{0:x})", hRes); } else { // FullName string strFullName; pResponsible.GetFullName(out strFullName); Console.WriteLine("Responsible full name: {0}", strFullName); // Comment string strComment; pResponsible.GetFullName(out strComment); Console.WriteLine("Responsible comment: {0}", strComment); } } else Console.WriteLine("Cannot open responsible (0x{0:x})", hRes); } } }
"Responsible full name: {0}"
"Responsible comment: {0}"
"Cannot open responsible (0x{0:x})"