New Posts New Posts RSS Feed: How Many Entity Managers should there be in an application?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

How Many Entity Managers should there be in an application?

 Post Reply Post Reply
Author
manishaudio View Drop Down
Newbie
Newbie


Joined: 24-Nov-2009
Posts: 8
Post Options Post Options   Quote manishaudio Quote  Post ReplyReply Direct Link To This Post Topic: How Many Entity Managers should there be in an application?
    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.
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
johnalphen View Drop Down
Newbie
Newbie
Avatar

Joined: 12-Mar-2010
Posts: 1
Post Options Post Options   Quote johnalphen Quote  Post ReplyReply Direct Link To This Post 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..

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down