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
|
What are the drawbacks of not using projection with data transfer objects? I already ran into one problem with the unitofwork thinking that anything I attached/imported was new because the EntityState was getting lost when I was converting from the model object to the contract object. |
|
|
Are you referring to materializing DTO's from a LINQ query? There are no particular drawbacks of taking this approach as opposed to manually mapping data across yourself, in fact generally projecting directly will be more efficient because you are not materializing an entire entity. One thing to be careful of is not traversing associations when projecting as this will require a full entity load to occur and then potentially a lazy load to traverse the association. In terms of mapping your DTO's back into a UnitOfWork, use UnitOfWork.Import as this will check if there is an existing entity based on the Id and then map the properties back against that entity rather than attaching it as new.
|
|