Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - Will WCF allow me to send custom object graphs over the wire?

 
 
Old 03-04-2006   #1 (permalink)
Greg Banister


 
 

Will WCF allow me to send custom object graphs over the wire?

I'm creatting a Wimforms SmartClient app where I control both sides of the
wire.
Will WCF allow me to send my custom objects (including private fields) over
the wire as I might have wisdth binary serialization and Remoting?
--
Greg

My System SpecsSystem Spec
Old 03-04-2006   #2 (permalink)
Damon Allison


 
 

Re: Will WCF allow me to send custom object graphs over the wire?

Hi Greg,

Take a look at the DataContractAttribute and the DataMemberAttribute.
You can attribute your classes and fields with these attributes and they
can be used over the wire. Here is an example of a small class that
is send across the wire in a service. In this example, all the fields
are marked as 'Public', however they could just have been marked
private. The data contract and OO interface do not have to coincide.
Whatever is marked as <DataMember()> will be serialized regardless of
the OO scope (private|internal|public).


HTH,
Damon



<DataContract()> _
Public Class PurchaseOrder

<DataMember()> _
Public Quantity As Integer

<DataMember()> _
Public Part As String

<DataMember()> _
Public CustomerID As String

End Class



<ServiceContract()> _
Public Interface IOrderPersist

<OperationContract(IsOneWay:=True)> _
Sub PersistOrder(ByVal order As PurchaseOrder)

End Interface



Public Class OrderPersist
Implements IOrderPersist

Public Sub PersistOrder(ByVal order As PurchaseOrder)
Implements IOrderPersist.PersistOrder
Console.WriteLine("Persisting Order. Customer Id: " &
order.CustomerID)
System.Threading.Thread.Sleep(5000) '// ToDo: SQL persistence.
Console.WriteLine("Order Peristed")
End Sub
End Class


Greg Banister wrote:
> I'm creatting a Wimforms SmartClient app where I control both sides of the
> wire.
> Will WCF allow me to send my custom objects (including private fields) over
> the wire as I might have wisdth binary serialization and Remoting?

My System SpecsSystem Spec
Old 03-04-2006   #3 (permalink)
Greg Banister


 
 

Re: Will WCF allow me to send custom object graphs over the wire?

Juval,
I understand your point Re: SOA when implementing Domain Service type
functionality, however would you limit the functionality of the client (which
is WinForms in my case) in order to maintain the SOA metaphor? Or given a
rich client environment would you consider breaking the "DoSomething()"
metaphor in order to maintain the type fidelity of your entity data, and
enable the utilization of the client environment to execute the kind of logic
(validation and even some business logic) that may be isolated to a single
aggregate?

I appreciate your feedback,
Greg Banister

--


"Juval Lowy" wrote:

> Hello Greg,
>
> The short answer is yes - as long as you have a serializable graph, even
> the same graph from remoting will work just fine.
> The long answer is that in a SO application, the interaction between a service
> provider and a service consumer should be in terms of "DoSomething()" not
> "GetMeYourData()". It is likely that complex graphs are technology specific
> and increase overall coupling.
>
> Hope that helps,
>
> Juval Lowy
>
>
>
> > I'm creatting a Wimforms SmartClient app where I control both sides of
> > the
> > wire.
> > Will WCF allow me to send my custom objects (including private fields)
> > over
> > the wire as I might have wisdth binary serialization and Remoting?

>
>
>

My System SpecsSystem Spec
Old 03-04-2006   #4 (permalink)
Juval Lowy


 
 

Re: Will WCF allow me to send custom object graphs over the wire?

Hello Greg,

My reservation was not due to cross-technology or interop issues. I simply
think that DoSomething() is better than GetMeTheData() as far as decoupling
goes.
WCF is not going to stand in your way when sending complex data graphs.

Thanks,

Juval Lowy

> Juval,
> I understand your point Re: SOA when implementing Domain Service type
> functionality, however would you limit the functionality of the client
> (which
> is WinForms in my case) in order to maintain the SOA metaphor? Or
> given a
> rich client environment would you consider breaking the
> "DoSomething()"
> metaphor in order to maintain the type fidelity of your entity data,
> and
> enable the utilization of the client environment to execute the kind
> of logic
> (validation and even some business logic) that may be isolated to a
> single
> aggregate?
> I appreciate your feedback,
> Greg Banister
>> Hello Greg,
>>
>> The short answer is yes - as long as you have a serializable graph,
>> even the same graph from remoting will work just fine. The long
>> answer is that in a SO application, the interaction between a service
>> provider and a service consumer should be in terms of "DoSomething()"
>> not "GetMeYourData()". It is likely that complex graphs are
>> technology specific and increase overall coupling.
>>
>> Hope that helps,
>>
>> Juval Lowy
>>
>>> I'm creatting a Wimforms SmartClient app where I control both sides
>>> of
>>> the
>>> wire.
>>> Will WCF allow me to send my custom objects (including private
>>> fields)
>>> over
>>> the wire as I might have wisdth binary serialization and Remoting?



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Problem exporting custom object to csv PowerShell
adding a custom object to array PowerShell
Adding a custom object to a collection multiple times PowerShell
Serialization: "Object Graphs" .NET General
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46