05-31-2013 01:10 PM
tried below and failed to cast,
SDataPayload contactPayLoad = (SDataPayload)payLoad.Values["Contact"]; IContact contact = (Sage.Entity.Interfaces.IContact)contactPayLoad;
Accessing an entity object via sdata payload could we do that ?
06-07-2013 08:41 PM
Thanks for the feedback @greensweater, however
what I learnt recently you wont be able to use entiyfactor unless you are not within the application.
(entity factory cannot be accessed via sdata)
so this wont work:
IContact contact = Sage.Platform.EntityFactory.GetById<IContact>(payLoad.Key);
06-07-2013 08:58 PM
You're trying to instantiate a contact entity (Sage.Entity.Interfaces.IContact). An SData payload is basically a JSON wrapper. You won't be able to cast that to an NHibernate entity object. If you want to instantiate an IContact you'll need the same ORM library that contains EntityFactory (Sage.Platform.dll) so I'm not sure what you mean that you can't access EntityFactory.
I may be able to better help you with more details on what you're trying to do.