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 don't know if it has something to do with Lightspeed, but I have a problem with dto and Visual Studio. I have a business layer in which I have a comon class Order and its dto object OrderDto. In WCF I return simple array of this dto objects: OrderDto[] GetObjects(); But VS generates a client proxy with method returning Order instead of OrderDto: private Order[] GetObjects() { ... } Why? It worked fine and now it doesn't. I don't know about I have changed anything. Is it that something is referenced or missing in references?
Thanks |
|
|
We set the DataContractAttribute.Name property on LightSpeed-generated DTOs to be the same as the server-side entities (i.e. without the "Dto" wart). I believe Visual Studio uses this to override the class name for generated proxies. Nothing has changed -- we have done this since day one. |
|
|
I don't understand. So on server I operate with business object Order and than I convert it into a dto object which I send via wcf service. And on client I get again business object instead of dto? BUT - even if it would be intended that way, I have this generated by VS: server: business object of type MyApplication.BusinessLayer.Order client: in WCF method (in generated proxy) I have return type MyApplication.Client.WCFServices.Order - should not be this same as in business layer?? (MyApplication.Client.WCFServices is namespace of generated proxy)
Thanks for your goodwill |
|
|
The generated proxy is plain old data -- it is NOT a business object. It has just been generated with the name "Order" rather than "OrderDto". The *name* happens to be the same as the business object, but that's just because the DataContractAttribute.Name happens to be the same as the business object. That is: Server: - Business object of type MyApplication.BusinessLayer.Order - DTO of type MyApplication.BusinessLayer.Contracts.Data.OrderDto with [DataContractAttribute(Name="Order")] Client: - Proxy object of type MyApplication.Client.WCFServices.Order - named after the DataContractAttribute.Name, NOT after the business object |
|
|
OrderDto is just the class name of the object on the service side. The object is being published under the alias "Order" over the wire which is why Visual Studio is generating a class with that name for you when you add a service reference. Your client side Order class will be equivilant to the service side OrderDto class.
Jeremy |
|