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 |
| 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
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