c# - Sharing .Net types in a wcf service with a no .Net client -
i develop webservice in wcf returning dataset.
when create .net test app consume wcf can receive dataset , assign datagrid without problem. visual studio job me.
but when partner trying consume wcf in c++ told me processes data xml , parsing string.
i guess there should exist better way consumes data.
because i'm not familiar c++, don't know how should work.
should create class dataset row , return myclass array instead?
now, on other hand if want receive dataset him?
how create xml?
or should receive xml string instead , parsing on side?
edit: in case c++ under linux.
the dataset .net data type won't have specific analogue in non .net languages. if c++ consumer using .net, in theory dataset should deserializable.
for api, want use simple custom objects , collection types can serialized array. example, if dataset has schema contains
column1 int column2 string column3 bool and forth, create custom class represent that:
public class yourobjecttype { public int column1 { get; set; } public string column2 { get; set; } public bool column3 { get; set; } } and store dataset contents in appropriate collection object. if sorting important, convert queue<yourobjecttype>, otherwise list<yourobjecttype> best approach. both of these types serialize array. can iterate across rows in dataset create 1 object per row , place object in new collection.
as further tip: performance boost, getting rid of dataset altogether. if pulling database, better datareader instead of dataset, , map contents of datareader directly new object type , collection. datasets computationally expensive compared directly reading database data.
Comments
Post a Comment