New Posts New Posts RSS Feed: Calling Poco Method from server
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Calling Poco Method from server

 Post Reply Post Reply
Author
jmpinchot View Drop Down
Newbie
Newbie
Avatar

Joined: 07-May-2010
Location: Florida
Posts: 22
Post Options Post Options   Quote jmpinchot Quote  Post ReplyReply Direct Link To This Post Topic: Calling Poco Method from server
    Posted: 04-May-2012 at 10:52am
Our project is structured such that the data layer is shared between both the client-side (WPF) application, and a asp.net server side application. We make widespread use of the POCO entity queries on both client and server sides of the app. I am wondering how the application routes the call to the POCO query if the calling code is on the server. Does it run back up through a network connection and back to the same machine? Or does the BOS somehow figure this out and simply calls the relevant code without the overhead of setting up a network connection?

By a similar token, how does this work for remote method invocation called from the server code (i.e. EntityManger.InvokeServerMethod)? 
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: 04-May-2012 at 11:52am
Since you'll always make a call from an EntityManager, the question is how does that EntityManager know or find an EntityServer to handle its queries, saves, or other calls.  Generally in server-side code (like an interceptor or login manager) you'll be provided with an EntityManager - that EntityManager is always directly connected to the EntityServer, basically as a 2-tier application - in other words there's no network or out-of-process communication occurring. 
 
If you "new" an EntityManager within server-side code and do not use the copy constructor, then that EntityManager will look at configuration settings by default to determine whether it should act in a 2-tier or n-tier manner - by default it will normally think it's using a local EntityServer and will therefore work like a 2-tier application.  Prior to the 6.1.7 release there were (somewhat rare) use cases where a new EntityServer instance could be created, but generally the EntityManager will talk directly to the current EntityServer. 
 
So, when you use an EntityManager from server-side code, unless you've specifically told it not to, it will not use a network connection and will do in-process calls to the current EntityServer instance.
 
If you think network calls are being made from a server-side EntityManager, check the debug log.  If the EM is trying to use WCF to talk to an EntityServer the log will include messages about WCF proxies created for certain addresses.  If so, then check your config file settings.
Back to Top
jmpinchot View Drop Down
Newbie
Newbie
Avatar

Joined: 07-May-2010
Location: Florida
Posts: 22
Post Options Post Options   Quote jmpinchot Quote  Post ReplyReply Direct Link To This Post Posted: 04-May-2012 at 11:55am
Awesome, thanks for the info.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down