| Visual Basic (Declaration) | |
|---|---|
Public Interface IPersistentFactory | |
| Visual Basic (Usage) | |
|---|---|
| |
| C# | |
|---|---|
public interface IPersistentFactory | |
| Managed Extensions for C++ | |
|---|---|
public __gc __interface IPersistentFactory | |
| C++/CLI | |
|---|---|
public interface class IPersistentFactory | |
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.
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)