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




Interface implemented by classes that create persistent object instances.

Syntax

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

Remarks

This interface is implemented by classes that create persistent object instances from persistent object types. The interface is registered with the static ObjectContext.PersistentFactory method and queried on each creation of a persistent object instance.

The interface should be implemented to improve the performance of persistent object creation.

The following example shows how to implement and register the interface.

public sealed class MyPersistentFactory : IPersistentFactory
{
            		public object CreateInstance(Type type, object[] parameters)
            		{
            			if (type == typeof(User))
            				return new User();
            			else if (type == typeof(Call))
            				return new Call();

            			// For all other types return null.
            			return null;
            		}
}

// Other code...

// Register the factory with the ObjectContext.
ObjectContext.PersistentFactory = new MyPersistentFactory();
            		

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