This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I'm using Lightspeed + WebORB + Adobe FLEX. WebORB is able to manage class mapping between flex client and server. All work file, except the object instance passed from the client side to the server: WebORB copy all object properties (including relationships not geared by DTOs ...) . The problem is when an instance come back to the server, it is not attached to the UOW and I can't set the object ID ... I migrated recently from NHibernate to Lighspeed. I never encountered this issue with NHibernate since you are able to set/get the ID transparently. It is possible to modify Lighspeed sources in order to intergrate a Entity Id setter ? |
|
|
No, entity IDs are immutable and cannot be changed. What you need to do is, rather than having WebORB create a new entity (and somehow assign its ID and trick LightSpeed into thinking that it should issue an UPDATE for the new entity rather than an INSERT), is to look up the existing entity by ID and apply the changes to the resulting entity: var entity = unitOfWork.FindById<MyEntity>(theId); |
|
|
Hi Ivan, I don't want to use DTO's classes.
cf: http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2695&PostID=10331 http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2695&PostID=11565 But, this imply to modify source code.I think to implement a setter to the public TId Id { get; set} and call UOW.Current.Attach(this) inside or something like that ... Could you indicate me if this can be possible ? Thanks in advance. |
|
|
No, we do not plan to implement a public setter for the Id property. Send the desired ID as part of or alongside your DTO (or whatever you call it, it doesn't have a LightSpeed generated DTO). Then call unitOfWork.FindById<>, and set the properties on the returned entity rather than creating a new entity. |
|