c# - Using a WCF Service with Complex Data Types -
i'm trying pass dto 1 navidation property ienumerable<> inside of it, when pass object without child lists works well, but, when i'm passing objects childs , grandchilds wcf services not respond , gives me no error. have make work type of object specificly?
here's data contract
[servicecontract] public interface iprodutoservice { [operationcontract] categoriaresponse getcategoria(categoriarequest request); [operationcontract] produtoresponse getproduto(produtorequest request); [operationcontract] categoriaresponse managecategoria(categoriarequest request); [operationcontract] produtoresponse manageproduto(produtorequest request); } //and dto class public class produtodto { #region primitive properties [datamember] public int32 codigo { get; set; } [datamember] public int32 codigocategoria { get; set; } [datamember] public string descricao { get; set; } [datamember] public decimal? preco { get; set; } #endregion #region navigation properties [datamember] public categoriadto categoria { get; set; } [datamember] public vendadto[] vendas { get; set; } #endregion }
// , service configuration looks this:
<services> <service behaviorconfiguration="behavioraction" name="uniarchitecture.produtoservice.serviceimplementations.produtoservice"> <endpoint binding="wshttpbinding" bindingconfiguration="bindingaction" contract="uniarchitecture.produtoservice.servicecontracts.iprodutoservice"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="behavioraction"> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> </servicebehaviors> </behaviors> <bindings> <wshttpbinding> <binding name="bindingaction" transactionflow="false" receivetimeout="00:30:00" > <reliablesession enabled="true"/> </binding> </wshttpbinding> </bindings>
it child objects not marked serializable.
it looks if missing datacontract attribute.
from comments below looks have objects not serializable. go through objects use , mark them th serializable or data contract attribute.
Comments
Post a Comment