T
Chili.Opf3 Send comments on this topic.
Generic ID Class
See Also  Members   Example 
Chili.Opf3 Namespace : Generic ID Class




Class that represents an identifier in the storage.

Syntax

Visual Basic (Declaration) 
Public NotInheritable Class ID(Of T As IComparable) 
   Implements IUserDefinedType 
Visual Basic (Usage)Copy Code
Dim instance As ID(Of T)
C# 
public sealed class ID<T> : IUserDefinedType  where T: IComparable
Managed Extensions for C++ 
public __gc __sealed class ID<T> : public IUserDefinedType  where T: IComparable
C++/CLI 
generic<typename T>
public ref class ID sealed : public IUserDefinedType  where T: IComparable

Type Parameters

T

Example

The following example shows how to use the class in a persistent object.
C#Copy Code
            [Persistent("USER")] 
public sealed class User 

    [Field("NAME", Mandatory = false)] 
    public string Name 
    { 
        // ... Code of the property. 
    } 
 
    [Field("ID", Mandatory = true, Identifier = true)] 
    public ID<string> Id 
    { 
        // ... Code of the property. 
    } 
 
    // ... Other code of the class. 

 
// ... Other code. 
 
User user = new User(); 
user.Id = ID.CreateGuidID(); 
 
User user1 = new User(); 
user1.Id = ID.CreateGuidID(); 
 
// Checks the values of the both IDs. 
if (user.Id == user1.Id) 

    // Should not enter here. 

 
// Copy the ID from one object to the other. 
// Now both IDs are conntected, since they are 
// the same instance. 
user.Id = user1.Id; 
    

Remarks

This class can be used to represent an Identifier in the storage. It is not necessary to use this class as identifier.

Inheritance Hierarchy

System.Object
   Chili.Opf3.ID

Requirements

Namespace: Chili.Opf3

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Chili.Opf3 (in Chili.Opf3.dll)

See Also