Print Page | Close Window

How Many Entity Managers should there be in an application?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1600
Printed Date: 02-Apr-2025 at 8:50pm


Topic: How Many Entity Managers should there be in an application?
Posted By: manishaudio
Subject: How Many Entity Managers should there be in an application?
Date Posted: 29-Dec-2009 at 7:55am
Hi,

I am building a SL 3 app with Page navigation framework. Currently, I am creating an EM for each page with basically the same model. What is the best way to consolidate using only one EM and have it accessible from all pages? Thoughts and comments appreciated.



Replies:
Posted By: GregD
Date Posted: 29-Dec-2009 at 12:33pm
The first EntityManager created in your app becomes the default EntityManager, accessible through the EntityManager.DefaultManager property. If no instance has been created, the DefaultManager property returns a new instance of EntityManager, and that instance becomes the default.

So you can initialize your EM on every page as follows:

     DomainModelEntityManager _mgr = DomainModelEntityManager.DefaultManager;

Then all your data retrieval operations will retrieve into a common cache.



Posted By: johnalphen
Date Posted: 12-Mar-2010 at 6:37pm

The types of entity are:

SGML entity, which is read by the SGML parser.

Data entity, which is read by the application.

Program entity, a data entity that is executed..



-------------
http://www.all4dotnet.com/productoverview.aspx - ffmpeg flv



Print Page | Close Window