Print Page | Close Window

Best Practices with EntityManager

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=1093
Printed Date: 02-May-2025 at 2:55am


Topic: Best Practices with EntityManager
Posted By: francois
Subject: Best Practices with EntityManager
Date Posted: 12-Feb-2009 at 11:40pm
Hi,

I'm busy evaluating DevForceEF to replace an existing in-house developed framework. Currently we have a client - server information system that is developed in a modular pattern. The client shell provides authentication / authorization services and a desktop. The client also currently support windows authentication and forms authentication.

The client have a plugin probe directory. If a plugin is found, it is loaded with dependency assemblies and the plugin injects the menus, views etc into the Desktop (very similar to CAB). These plugins can be mixed and matched as required. Each plugin assumes an already authenticated session provided by the client. Plugins can also extend other entities like CAB.

Implementing this with DevForceEF seems to be a bit more complex as I thought. The authentication / authorization of the client can be achieved by creating a very simple domain model and to use the login with custom login credentials. But how do I cater for the plugin design?

Each plugin is in a way it's own domain model (which could potentially have dependencies on other domain models for referential integrity).

Basic architecture guidelines would be great.

Thanks








Replies:
Posted By: francois
Date Posted: 16-Feb-2009 at 10:43am

Any ideas?



Posted By: GregD
Date Posted: 18-Feb-2009 at 1:28pm
Originally posted by francois

Hi,
I'm busy evaluating DevForceEF to replace an existing in-house developed framework. Currently we have a client - server information system that is developed in a modular pattern. The client shell provides authentication / authorization services and a desktop. The client also currently support windows authentication and forms authentication.

The client have a plugin probe directory. If a plugin is found, it is loaded with dependency assemblies and the plugin injects the menus, views etc into the Desktop (very similar to CAB). These plugins can be mixed and matched as required. Each plugin assumes an already authenticated session provided by the client. Plugins can also extend other entities like CAB.

Implementing this with DevForceEF seems to be a bit more complex as I thought. The authentication / authorization of the client can be achieved by creating a very simple domain model and to use the login with custom login credentials. But how do I cater for the plugin design?

Each plugin is in a way it's own domain model (which could potentially have dependencies on other domain models for referential integrity).

Basic architecture guidelines would be great.

Thanks


Sorry for the delay, Francois. I ran this by Ward Bell, our VP of Product Development, who had the comments listed below.

It’s a sensible question but I don’t know enough about the plug-in authentication to suggest wisely.

 

Typically, I would do as he suggested for the opening gambit … login an EntityManager at the start. No unusual complexity there.

 

Then I would put an AuthenticationService and AuthorizationService in my IoC container. Subsequent plugins are serviced from these services.

 

I’m imagining that the plug-ins have their own domain models and, therefore, their own EntityManager instances. The question might be, “how do I login these Ems without actually going back to the user again for credentials?”

 

If this actually IS the question, the solution is easy. The plug-in can ask the AuthenticationService to “new” it’s own specialized EntityManager based on the originally logged in EM that is retained/referenced by the AuthenticationService.

 

I imagine a method such as

 

                 Service.CreateEntityManager<T>() where T : EntityManager, new()

 

The implementation is a one-liner sort of like:

 

                return new T(HomeEntityManager); // HomeEntityManager provides access to the originally logged in EM

 

I don’t think I dare go further without more information about what seems to be the problem and desired outcome.

 


Perhaps Francois would like to contact us directly.     [which you can do through support@ideablade.com]




Posted By: francois
Date Posted: 19-Feb-2009 at 12:19am
Hi,
 
Thanks, this is basically what I was looking for.
 
Will clarify details through email if required.
 
Regards,
 
Francois



Print Page | Close Window