WCF -> Adapter -> Rehydrate?

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 28-Sep-2007 20:21:11   

What's the best practice for this senerio?

A business server has an LLBL generated Adapter project of Customers with Orders.

A client requests via net.tcp remoting the Customer object with their Orders.

WCF transmits the object and we get an IEntityCollection2 object of the customer and their orders. I've tested this out and it works fine.

I want to end up with a filled LLBL generated Customer with Orders graph and use all the nice tools/events/goodies that come with binding a UI to a LLBL EntitCollection.

I see two options, but am unsure if they work:

1) I'd like to take the IEntityCollection2 and rehydrate the Customer and Orders object graph. I'll probably have to have the same DLL LLBL makes on both the server and client?? Can/should I cast the IEntityCollection2 to a CustomerCollection?

2) Another way which I am not sure if it's possible: Create a simple Customer with Orders LLBL project for the client and "fill" it with the IEntityCollection2 recieved from WCF from the server? When I am done with it, re-transmit it back to the Server?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-Oct-2007 10:06:51   

I want to end up with a filled LLBL generated Customer with Orders graph and use all the nice tools/events/goodies that come with binding a UI to a LLBL EntitCollection.

I don't understand the requirement here, you already have got an IEntityCollection right?

1) I'd like to take the IEntityCollection2 and rehydrate the Customer and Orders object graph. I'll probably have to have the same DLL LLBL makes on both the server and client?? Can/should I cast the IEntityCollection2 to a CustomerCollection?

There is no CustomerCollection in the Adapter model, but in the client you may create a collection with the CustomerEntityFactory and fill it with the result of the server method.

ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 01-Oct-2007 12:39:18   

There is no CustomerCollection in the Adapter model, but in the client you may create a collection with the CustomerEntityFactory and fill it with the result of the server method.

Ah yes, I was thinking SelfService. That's what I'm looking for.

I don't understand the requirement here, you already have got an IEntityCollection right?

Correct.

Basically is it possible to have 2 identical Adapter projects. A server project that we'll embed lots of server logic into and a client one that is geared towards UI. The schemas would be identical.

Could we take the IEntityCollection returned from the server then fill the client version with that? Once done with it, transmit it back to the server? I seem to remember reading that in a post somewhere and want to confirm.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Oct-2007 13:14:04   

Basically is it possible to have 2 identical Adapter projects. A server project that we'll embed lots of server logic into and a client one that is geared towards UI. The schemas would be identical.

Could we take the IEntityCollection returned from the server then fill the client version with that? Once done with it, transmit it back to the server? I seem to remember reading that in a post somewhere and want to confirm.

Although I can't justify it, I see no problem in this approach. Most probably at client side you will need DTO, or DBGeneric Objects. And if you have Server Logic to implement, then this should go into a BL layer residing in the server. And if you want to implement them in the entityClasses, then maybe you need to use 2-Class templates.