Chili.Opf3 Send comments on this topic.
IUserDefinedType Interface
See Also  Members   Example
Chili.Opf3 Namespace : IUserDefinedType Interface




Interface implemented by user-defined types (types that are not directly supported by the storage).

Syntax

Visual Basic (Declaration) 
Public Interface IUserDefinedType 
Visual Basic (Usage)Copy Code
Dim instance As IUserDefinedType
C# 
public interface IUserDefinedType 
Managed Extensions for C++ 
public __gc __interface IUserDefinedType 
C++/CLI 
public interface class IUserDefinedType 

Example

The following example shows how to implement the interface in your own types.
C#Copy Code
public class MyUDT : IUserDefinedType 

    private string _simpleObj = null; 
 
    public void FromSimpleDataType(object value) 
    { 
        if (value is string) 
            _simpleObj = (string)value; 
    } 
 
    public object ToSimpleDataType() 
    { 
        return _simpleObj; 
    } 
 
    public Type SupportedType 
    { 
        get { return typeof(string); } 
    } 
 
    // ... Other properties and methods. 

    

Remarks

Attention: Classes implementing this interface need a constructor without arguments. It may be either public, internal or private.

This interface allows creating user-defined types (types that are nod directly supported by the storage) that can then be persisted to the storage and loaded from the storage. If the storage does not directly implement the type you want save you can implement this interface to save that object to the storage.

The interface contains two methods:
FromSimpleType and ToSimpleDataType. The first method has one argument that is set during load and allows you to populate the object with the data from the storage. The second method converts the object to a type that can be saved to the storage (for example a xml string) and is called during the save process. Currently ID, Blob and the DynamicProperties implement this interface.

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