Print Page | Close Window

How can refresh the MainEntityManager after new login ?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1062
Printed Date: 28-Apr-2024 at 7:46am


Topic: How can refresh the MainEntityManager after new login ?
Posted By: aladdin
Subject: How can refresh the MainEntityManager after new login ?
Date Posted: 19-Jan-2009 at 9:16am
Hi.Happy new year.

my question is about EntityManagerService.

How can refresh the MainEntityManager after new login ?
       ...my steps
       PersistenceManager  pManager = new PersistenceManager(true, "extention");
       pManager.Login(new LoginCredential("admin2", "password2", "")
       ...after success login the DefaultManager and the MainPm.Manager must look the new manager
       PersistenceManager.DefaultManager = pManager;
       MainPm.Initialize();

because the MainEntityManager hold the old PersistenceManager from the initialization.

It is the right way to remove the MainEntityManager

       EntityManagerService.RemoveEntityManager (MainEntityManager ) from the servise

and add it again
       AddNewEntityManager<MainEntityManager>(
                                   EntityManagerNames.MainEntityManager, MainPm.Manager, false);

thanks



Print Page | Close Window