Class that represents the
ObjectContextFactory's
policy base class. It needs to be implemented by policies and holds the logic for creating
new
ObjectContext instances.
Syntax
| Visual Basic (Declaration) | |
|---|
Public MustInherit Class ObjectContextFactoryPolicyBase |
| C# | |
|---|
public abstract class ObjectContextFactoryPolicyBase |
| Managed Extensions for C++ | |
|---|
public __gc abstract class ObjectContextFactoryPolicyBase |
| C++/CLI | |
|---|
public ref class ObjectContextFactoryPolicyBase abstract |
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(); |
Inheritance Hierarchy
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