New Posts New Posts RSS Feed: Generated EntityManager on the server
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Generated EntityManager on the server

 Post Reply Post Reply
Author
stephenmcd1 View Drop Down
DevForce MVP
DevForce MVP


Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
Post Options Post Options   Quote stephenmcd1 Quote  Post ReplyReply Direct Link To This Post Topic: Generated EntityManager on the server
    Posted: 09-Apr-2013 at 11:13am
We currently have a bunch of custom code (helper methods, etc.) in our custom sub-class of EntityManager - and that is in addition to all the code that the standard T4s generate (for building entity queries and stored procedure queries).  The trouble comes when we are on the Web Server during a query or save.  In that case, all the Entity Managers are just the 'vanilla' EntityManager class so we end up with a lot of code that needs to behave slightly differently on the server than it does on the client.  It's not terrible but the friction is starting to add up and I think we need to do something about it.

I'm looking at moving all the logic that is currently in our EntityManager sub-class into a separate standalone class that can 'wrap' any EntityManager and provide the same query building, etc. logic.  With some simple tweaks in the T4s, this doesn't look to hard.  However, I first wanted to ask if you would consider making this the default behavior (or perhaps some sort of configuration / opt-in behavior)?  It seems like this would be a good feature in general if the EntityManagers on the sever could be the custom typed version.

But if it doesn't seem like that will happen, I'll go ahead with my standalone helper class idea.

Thanks,
-Stephen
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 10-Apr-2013 at 8:41am
Hi Stephen,

This isn't something we plan to address in the near term, so you're better off going with your idea.

Although most applications do have only a single sub-typed EntityManager, a fair number have multiple models, so we'd need some sort of factory method we could call on the server to obtain an EM or the type of the EM. Or we could do as we do with RPC methods and pass the EM type with the message. At any rate, although a bit of a pain, it's still usually easy enough to use the EM copy constructor, an extensions class, or a wrapper class to work with the EntityManager.
Back to Top
stephenmcd1 View Drop Down
DevForce MVP
DevForce MVP


Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
Post Options Post Options   Quote stephenmcd1 Quote  Post ReplyReply Direct Link To This Post Posted: 10-Apr-2013 at 9:49am
Thanks for the update.  I'll continue on with my own way.  

On a side note, I just noticed that custom logic you do with RPC calls to create the correct type of EM.  I had never noticed that before because we always have code that tries to support a custom sub-type as well as a plain one.  That could be nice to do that kind of thing for queries and saves....but I understand it's probably one of the more obscure feature requests I've come up with so I won't bother.

Thanks!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down