IdeaBlade DevForce 2010 Help Reference
EntityManager Class
Members  See Also  Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace : EntityManager Class



Management class for all high-level retrieval, caching and persistence operations on entities.

Object Model

EntityManager ClassIAuthenticationContext InterfaceCacheStateManager ClassCompositionContext ClassEntityReferenceStrategy ClassEntityManager ClassQueryStrategy ClassSaveOptions ClassEntityMetadataStore ClassEntityManagerOptions ClassQueryCache ClassVerifierEngine Class

Syntax

Visual Basic (Declaration) 
<DebuggerNonUserCodeAttribute()>
Public Class EntityManager 
   Implements IEntityManagerAsync 
Visual Basic (Usage)Copy Code
Dim instance As EntityManager
C# 
[DebuggerNonUserCodeAttribute()]
public class EntityManager : IEntityManagerAsync  
C++/CLI 
[DebuggerNonUserCodeAttribute()]
public ref class EntityManager : public IEntityManagerAsync  

Remarks

The EntityManager is responsible for communicating with an IdeaBlade.EntityModel.Server.EntityServer to retrieve entities from and persist entities to their backend data sources, managing entities in its cache, creating new entities, ensuring entity security, and persisting its cache to local storage to facilitate disconnected access.

A single EntityManager can manage entities backed by any number of data sources. It caches entities and queries, both to improve performance and to support offline operation of applications. Entities remain in the cache until the application terminates or they are explicitly removed.

Use Login and Logout to validate a user's credentials and provide session-level security to the IdeaBlade.EntityModel.Server.EntityServer. You'll need to implement IEntityLoginManager to perform this validation. If login security is required, be sure to call Login prior to performing any other EntityManager actions.

Use Connect and Disconnect to explicitly manage connection state to the EntityServer. Use the EntityManager.EntityServerError delegate to set up an error handler to catch connection and other EntityServer problems.

Use any of the ExecuteQuery overloads to explicitly retrieve entities from either a backend data source or the EntityManager's cache. When using an EntityQuery or any query implementing System.Collections.IEnumerable you can also take advantage of "deferred execution" and implicitly retrieve the requested results by enumerating over the query or calling either ToList() or ToArray(). For more information on deferred vs. immediate execution and LINQ queries, see the Language-Integrated Query topic in the Visual Studio documentation.

Use CreateEntity or its overloads to create new entity instances, and AddEntity to add the new entity to the entity cache. Use one of the SaveChanges overloads to persist changed entities to a backend data source.

Use CacheStateManager.SaveCacheState to save cached data and the state of the EntityManager to the local file system. Use CacheStateManager.RestoreCacheState to restore from the saved file. Use ImportEntities to move entities between EntityManagers.

Corresponding asynchronous methods are available for any operation which may access the EntityServer. See ConnectAsync, LoginAsync, EntityManager.ExecuteQueryAsync, EntityManager.SaveChangesAsync and InvokeServerMethodAsync(ServerMethodDelegate,Object[]).

Note: The EntityManager is not thread-safe.

Inheritance Hierarchy

System.Object
   IdeaBlade.EntityModel.EntityManager

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.