And what if we are not using WCF ?

Thanks in advance

2017-10-26 12:55 GMT+03:00 Mamy Andriamasinoro <[email protected]>
:

> Hi Marc;
>
> I'm trying to serialize a csv file which contains thousands lines of query
> results. It works fine, but I'm stuck on how to display the results on an
> aspx page. Any idea please?
>
> Le jeudi 27 mai 2010 09:30:03 UTC+3, Marc Gravell a écrit :
>>
>> With "full" .NET to .NET WCF, then switching the serialization layer to
>> use protobuf-net can (depending on a few factors) be as simple as a
>> configuration file change:
>> http://marcgravell.blogspot.com/2009/11/controlling-wcf-prot
>> obuf-net-at.html
>>
>>
>> <http://marcgravell.blogspot.com/2009/11/controlling-wcf-protobuf-net-at.html>*Unfortunately*,
>> this doesn't apply to Silverlight since Silverlight lacks that extension
>> point. There is no *silent* way of switching the serializer for
>> Silverlight. Instead the main mechanism for this would instead resolve
>> around exposing (on your WCF API) binary data - either byte[] or
>> Stream. You would, of course, then have to serialize/deserialize
>> manually. Nowhere near as elegant as you can achieve in full .NET, but it
>> still works. WCF essentially then becomes a plumbing layer, rather than
>> representing the actual data API.
>>
>> On the topic of data-contracts, you have a few options - if you have
>> existing data-contracts of the type:
>>
>>     [DataContract]
>>     public class MyData {
>>         [DataMember]
>>         public int Foo {get;set;}
>>
>>         [DataMember]
>>         public string Bar {get;set;}
>>     }
>>
>> then all that is required is to associate a unique number with each
>> member (unique within the type, if you see what I mean). This can be done
>> using the Order property:
>>
>>     [DataContract]
>>     public class MyData {
>>         [DataMember(Order=1)]
>>         public int Foo {get;set;}
>>
>>         [DataMember(Order=2)]
>>         public string Bar {get;set;}
>>     }
>>
>> or using protobuf-net's own attributes:
>>
>>     [ProtoContract]
>>     public class MyData {
>>         [ProtoMember(1)]
>>         public int Foo {get;set;}
>>
>>         [ProtoMember(2)]
>>         public string Bar {get;set;}
>>     }
>>
>> It is important that the client and server agree about the numbers.
>>
>> Alternatively, if you *don't* have existing types you can also start from
>> a .proto file; the generator included with protobuf-net can emit suitable
>> types for you.
>>
>> Re transport; if you are using WCF over HTTP, it is usually worthwhile
>> enable MTOM; but I can't recall whether this is supported under Silverlight.
>>
>> Re serialization; if we assume you are throwing byte[] up and down the
>> wire, you should just need something like:
>>
>>     MyData obj = new MyData { Foo = 123, Bar = "abc" };
>>     byte[] blob;
>>     using(var ms = new MemoryStream()) {
>>         Serializer.Serialize(ms,obj);
>>         blob = ms.ToArray();
>>     }
>>
>> and then to deserialize:
>>
>>     MyData obj;
>>     using(var ms = new MemoryStream(blob)) {
>>         obj = Serializer.Deserialize<MyData>(ms);
>>     }
>>
>> That should cover the main points. If there are more questions, please
>> let me know.
>>
>> Marc Gravell
>> (protobuf-net)
>>
>>
>>
>> On 27 May 2010 05:52, vikram <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I am new to Protocol Buffer.
>>> I wanted to implement protocolbuffer for binary serialization for my
>>> WCF service.
>>>
>>> My requirement goes as given below:
>>>
>>> FrontEnd: SilverLight 3.0
>>> Middlelayer:  WCF Service (.NET 3.5)
>>>
>>> I would like to know what things need to be incoporate in my WCF
>>> service to implemement
>>> protobuf-net. (If possible provide an example it would be more
>>> helpful)
>>>
>>> Is there any addition things need to be handled while creating a proxy
>>> class for my WCF service or else i can use regular svcutil.exe for
>>> generate my proxy class.
>>> (If possible provide an example it would be more helpful)
>>>
>>> In frontEnd, how to i serialize/de-serialize object from my service
>>> call via proxy class.
>>> (If possible provide an example it would be more helpful)
>>>
>>> Thanxs in advance
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Protocol Buffers" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at http://groups.google.com/group
>>> /protobuf?hl=en.
>>>
>>>
>>
>>
>> --
>> Regards,
>>
>> Marc
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Protocol Buffers" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/protobuf/Hn2KKlNaLIE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to