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
|
I just started playing around with the DTO support and noticed that it only generates DTOs for the Entity as well as AsDto and CopyTo for entity and DTO. I believe the implementation would be more complete if we also got List<DTO> and AsDto(IList<Entity>) and CopyTo(List<DTO>,IList<Entity>). So, instead of: public List<DashboardStatisticDto> RetrieveStatistics(DateTime startDate, int hostId) List<DashboardStatisticDto> statsDto = new List<DashboardStatisticDto>(); You could have: public DashboardStatisticDtoList RetrieveStatistics(DateTime startDate, int hostId) return stats.AsDto();
|
|
|
Hi Scott, We agree and we have been planning to add at least the AsDto overload at some point. The CopyTo overload is a bit trickier because at the moment we don't include the Id in the DTO (because of concerns around it being misleading in insert-type operations), which means relating the DTO to the entity requires out-of-band information. We'd welcome your thoughts on this. |
|
|
I like the start that you have made with the WCF support. Generating simple types that map to the entities is the right way to go and preserving as much POCO'ness as possible is simple. The DTOs should look like DTOs and not complex ORM entites. All this being said, there are some things which need to be supported across the DTO. Change tracking is one of them. The DataContractSerializer is a PITA in that it does not suport XML shaping in the way one would like making this problem harder. Ideally we could do something like this: class PersonDto { Identity<Int> Id { get; set; } string Name { get; set} } The XML would look like this: <PersonDto> <Id Status="New|Modified|Deleted">100</Id> <Name>Scott</Name> </PersonDto> Then the mapping back and forth could set this state on the Entity.
|
|
|
File attached. You also need to change Base.vm to add Systems.Collections.Generic
|
|
|
Is it possible to have these changes incorporated into future builds? My most recent datacontracts.vm doesn't seem to have these changes, and I've been using these lists a lot with WCF. |
|
|
Hello dear colleagues, [quote user="sprugh"] All this being said, there are some things which need to be supported across the DTO. Change tracking is one of them. [/quote] Any news on the suggestion above about change tracking and Id field in Dto? We are currently evaluating the LightSpeed. We need it for distributed application with WCF (both tcp and http bindings). It sounds great that you have Dto objects generated with all the attributes for WCF and conversion methods, but it is not convenient if there is no Id and change racking (status like new/modified/deleted)... Best regards |
|