I have a WCF serivce which implements an interface method to save an entity like this:
IFinantialTxService svc = BaseServiceLayer.CreateChannel<IFinantialTxService>
SomeEntity cur = GetCurrentObject() as SomeEntity;
svc.SaveFinTxName(cur);
OK, now “cur” object is a new entity created and filled by the client user, it has an identity field and a time stamp that will be filled by the database after insertion.
how can i reflect these two fields to the client? should i pass the entity by reference? or may i get a new instance from the database right after saving? or should i return them as an output or return values from the service?
any ideas i’ll be appreciated.
You cannot send object by reference in WCF. WCF as any technology that sends data across process boundaries does not support that. Any object you send is serialized (into XML, JASON, Binary stream depending on your binding) and de-serialized when it is sent from client to server or from server to client.
You should sent entity with populated fields back to client instead of
void.Replace this:
with this line: