docs.intersystems.com
MultiValue Quick Start Tutorial
Retrieving an Object
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Search:    

Here is standard .NET (C#) code that uses .NET proxy objects to display the data for a PERSON record. In detail, the code does the following:

  1. Opens an instance of the .NET proxy class PERSON. This class is the proxy for the Caché MVFILE.PERSON class. Each proxy for a persistent Caché class has an Open method. This method opens an instance of the proxy in the .NET runtime as well as the corresponding Caché object in the Caché server. The method takes both the Caché object ID for the instance as well as an open CacheConnection object as arguments.
  2. Retrieves the Caché object's property values using the corresponding properties of the proxy.
  3. Retrieves each of the elements of the PHONE array. The .NET proxy represents this array as an instance of CacheListOfStrings.
MVFILE.PERSON person = MVFILE.PERSON.OpenId(cnCache, "1");

Console.WriteLine("Name: {0} Age: {1} Hair: {2}", 
                 person.Name, person.Age, person.Hair);

CacheListOfStrings phones = person.Phone;

foreach (String pn in phones)
                Console.WriteLine (pn);       
         
Note:
The above code is contained in ObjectAccess.cs. This file is in <cachesys>\Dev\tutorials\mv. Executing the .NET Examples contains step-by-step instructions for executing this code.


Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA