New Posts New Posts RSS Feed: Passing data from client to server
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Passing data from client to server

 Post Reply Post Reply
Author
LesleySastro View Drop Down
Newbie
Newbie


Joined: 13-Nov-2008
Posts: 9
Post Options Post Options   Quote LesleySastro Quote  Post ReplyReply Direct Link To This Post Topic: Passing data from client to server
    Posted: 22-Dec-2008 at 7:28am
What is the best way to send some specific data from the client to the server? Like f.e. for my audit trail feature I need to know from which client/workstation (name/ip-address) the changes has been done. So what I have been trying to do is to use the Tag property of the EntityManager object, and this is not working because I fill in the Tag property of the Client-Side entitymanager object with workstation name and ip-address, but on the server side this Tag property is still null. That makes sense because DevForce EF makes a new EntityManager for the server side (IEntityLoginManager and IEntityServerSaving), and does not have knowledge of the client entitymanager properties. So I still have a problem getting specific data from the client to the server. Does anyone know how to do this?
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: 22-Dec-2008 at 7:20pm
You're exactly right that the EntityManager on the server side does not have any knowledge of the properties of the client EntityManager.  The client EntityManager is not ever transmitted to the server - during a save only information concerning the added/modified/deleted entities is sent to the BOS.
 
Some possible options -
  - If you can, add these audit properties to your Entities, and maybe use an injected base type, a complex type, or other inheritance to provide a common means of working with these fields.
 
- Create a custom IPrincipal implementation which includes the audit info.  You'd probably also need a custom ILoginCredential to initially pass the fields to the LoginManager, which would return the custom IPrinicipal.  This principal would then be available on both client and server.
 
 
Back to Top
LesleySastro View Drop Down
Newbie
Newbie


Joined: 13-Nov-2008
Posts: 9
Post Options Post Options   Quote LesleySastro Quote  Post ReplyReply Direct Link To This Post Posted: 23-Dec-2008 at 12:54pm
Thanks Kim, I already figured those options out. So I'm using actually a combination of both those options, but I was hoping that there was a hidden feature or much simpler solution that I could use.
 
BTW, I'm using a custom ILoginCredential to pass the data to the LoginManager, and then return the normal GenericPrincipal with a custom Identity. I store the data in the custom Identity for further use. Since the GenericPrincipal goes back and forward between the client and server I can always access the data. 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down