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 am evaluating Lightspeed. DTO generation is a good think you have except that the dtos dont preserver my id and the entity state. Have i done something wrong? i am simulating the workflow as it will be in a wcf environment
sample code: table CREATE TABLE [dbo].[AppUser](
AppUser user; until here it should be the dal and service from here i get the dto and copy it over to a Entity in order to have all databinding features. (IDataErrorInfo, IDeserializationCallback, IEditableObject, INotifyPropertyChanged
) var userBO = new AppUser();
|
|
|
DTOs do not copy the Id and EntityState because these are not writeable features of an entity. In particular it is often not meaningful for a client to send an Id or EntityState to the service (e.g. if the operation will be performing an insert). If you need to transmit the Id and EntityState, you can do this in either of two ways: 1. Extend the DTO using the partial class feature to add the required properties. (There is a DTO base class if you want to do this for all DTO types.) Then implement the copy partial method to copy the values from the entity into the DTO. (See the generated code for the partial method definition.) 2. Send the info in separate members of the WCF message (or separate parameters of the WCF operation). E.g. class MyMessage { ProductDto Product; int Id; EntityState State; }. |
|