WindowsDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


AddThis Social Bookmark Button

Object-Oriented Data Programming: C# Meets Caché
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9

Finally, we are ready to create the Patient class. Right-click on User and choose Create New Class, and name the class Patient, but click Next to go to the second step in the wizard. Until now we have been (implicitly) accepting the default Persistent type, which allows the class to be stored in the database. This time, however, we are creating Patient and a sub-class of Person, so click Extends and use the Browse button to find the super class (Person) as shown in Figure 8.



Create Sub Class
Figure 8. Selecting the super class

When you click OK in the Class Selector Dialog, the class name User.Person will be filled in as the name of the super class; click Finish.

Add Doctor as a string property, then add Prescription. This time, when you choose Relationship, be sure to choose "Many:many other objects" from the relationship characteristics, as shown in Figure 9.

One To Many
Figure 9. Choosing a one:many relationship

By creating this one:many relationship in Caché we ensure that in C#, the Patient object will have a collection of Prescriptions.

That's it! We've created all the Caché classes we need. Click the Rebuild All button, as shown in Figure 10, to save and build the application in Caché.

Rebuild All
Figure 10. Rebuild All saves and builds the app in Caché

Assuming the result window says that your "Compilation finished successfully," you are ready to leave Caché and move to Visual Studio.

Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9

Next Pagearrow