Compartilhar via


Managing Resources in Object Services (Entity Framework)

When you execute an ObjectQuery within an object context, the objects returned by the query are loaded into the object context. Object Services tracks changes to objects in an object context. These changes are propagated back to the data source when SaveChanges is called. The object context itself is often limited within the scope of a using statement (Using...End Using in Visual Basic). In this case, objects are removed and the connection to the database is closed when the context itself is disposed. It is important that you call Dispose on a long running object context when it is no longer required. Otherwise, the context maintains the connection. For more information, see Managing Connections in Object Services (Entity Framework).

Object Services also enables you to manage the amount of memory used by an active object context by providing a way to remove objects from the context when they are no longer needed. For more information, see Detaching Objects (Entity Framework).

Object Services supports .NET Framework transactions to coordinate operations against the data source and to enlist in distributed transactions. For more information, see Managing Transactions in Object Services (Entity Framework).

See Also

Other Resources

Managing the Object Context (Entity Framework)