Chili.Opf3 Send comments on this topic.
ObjectContextFactory Class
See Also  Members   Example 
Chili.Opf3 Namespace : ObjectContextFactory Class




Class that represents a factory class for ObjectContext instances. Use the ObjectContext's static Factory property to get an instance.

Object Model


Syntax

Visual Basic (Declaration) 
Public NotInheritable Class ObjectContextFactory 
Visual Basic (Usage)Copy Code
Dim instance As ObjectContextFactory
C# 
public sealed class ObjectContextFactory 
Managed Extensions for C++ 
public __gc __sealed class ObjectContextFactory 
C++/CLI 
public ref class ObjectContextFactory sealed 

Example

This example shows how to set up the factory to create an ObjectContext instance for each new thread.
C#Copy Code
// Set the policy for multi threading. 
ObjectContext.Factory.Policy = new PerThreadObjectContextFactoryPolicy(delegate() 

    MsSqlStorage storage = new MsSqlStorage("... connection string ..."); 
    ObjectContext ctx = new ObjectContext(storage); 
 
    return ctx; 
}); 
 
// ... Other code 
 
// Have an ObjectContext instance created 
ObjectContext context = ObjectContext.Factory.GetObjectContext();

Remarks

This class represents a factory pattern for creating ObjectContext instances. The class requires to set a class that inherits from ObjectContextFactoryPolicyBase (Policy property). That class represents a policy for creating new ObjectContext instances.

Inheritance Hierarchy

System.Object
   Chili.Opf3.ObjectContextFactory

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