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. In the current documentation I read, "The default mapping approach provided with IUnitOfWork.Import will work well for one to one style mapping and constrains you to the use of a key property to ensure you get conditional insert/update behaviour. Lastly associations are also not currently traversed as part of the mapping so in the earlier example if an ApplicationMember held Contribution and Comments collections then these would not be imported back into the UnitOfWork." In this thread -- http://www.mindscapehq.com/forums/thread/4428 -- Jeremy wrote, "support for traversal of associations is something we intent to add in but it didnt make it for 4.0. Its on our backlog for upcoming work but I cant promise anything just yet!" Has anything changed around this? Also, in the API I noticed that there is, in addition to the import-object methods, this: "public TEntity Import So, if I import a LS Entity whose Id is the same as an existing Entity, will the import process also bring in any associated child collections? If there have been rows updated, deleted, or added in those collections, will LS handle all those changes correctly? Or are entities handled like objects during import? If this is the case, any ideas for how one would work around this -- say you have a DTO or Entity with associated collections that have been edited/updated, how do you merge all those changes back to the existing entity? I could write a custom routine for each case, but can't help wondering if there's some LS magic that would make it easier. Vikram |
|
|
No nothing has changed with this. Calling Import(TEntity entity) will only import the entity itself and not any associated child collections. Managing the add/update/remove in these child collections is something you will need to manage manually at this stage. As you mentioned, you will need to write a custom routine for each case - unfortunately there is no more magic there yet! :)
|
|
|
Jeremy Is this planned for inclusion in LightSpeed 5.0? Thanks |
|
|
Hi James, No this is not going to be included in 5 but it is still on the backlog. If you want to raise the visibility of this please feel free to pop this on the feature request list and get some voting occurring on this as we use that as a guide to what the most important customer enhancements are.
|
|