Hi
If I understand correctly, there is no mean to use the CSLA without the client getting reference to the business object library; we can’t use something like shared interface between server and clients.
In our model object, the client app is very simple. It receives an object and just calls the “execute” method of the object, then saves the object. Let say the client gets a Doc object from Document class. It just does “Doc.execute”.
What is the best solution, if the Business library always changes? Let’s say the “execute” method change, we frequently write a new code. Do we have to install all the clients again with a new version, across the country?
Thanks for your help
Cordially
Richard
The data portal is designed to enable mobile objects, which is a form of client/server. Part of the bargain is that the client and server need to have the same business assembly (dll). Both the client and server are tiers in the same app, and are merely deployment choices you've made.
But you don't have to use the data portal. If you want to create a service-oriented system, for example, you can use CSLA to create both client and server applications. But it is important to realize you are creating two applications.
In the client app, you would typically configure the data portal to run local, on the client. The DataPortal_XYZ methods call services in this case, rather than calling stored procedures.
In the server app, you should follow the model shown in Chapter 11, abstracting the service interface with DTOs (message objects) and calling the real business object in your asmx or svc code.
The BenchManager sample I created for Tech Ed illustrates how this works. Actually it has both models - BenchManager is client/server, BenchManagerSO is service-oriented.
The thing is, the decision to go client/server or SO is a fundamental choice. Both have their strengths and weaknesses, and it is important to choose the right architecture for your needs, or you'll suffer some nasty consequences pretty much every time...
Thanks for the answer, Rocky.
As interoperability is not an issue for us and as we need good performances, we did not choose a SO solution, but a client/server one.
What I was thinking was about an implementation with a shared interface between server and client side.
You can certainly do that, but that is not how the data portal is designed to work.
The challenge with the shared interface approach is that "interface" is more than the API - it also must include some "message contract". Even if you aren't "SOA" you still need to get the data across the wire after all - and if you don't want a shared business assembly, then you need a shared DTO (data transfer object) assembly.
You can use pre-built .NET objects, allowing .NET itself to be the shared assembly. Options include the DataSet, arrays, lists, dictionaries, hashtables, etc. All loosely typed obviously.
Or you can use a shared DTO assembly, in which case you can create strongly typed DTOs, or strongly typed DataSet objects - either way works.
But if you use a shared DTO assembly you have the same deployment issues as with a business assembly. And in that case, I'd personally use the data portal, because it offers other benefits like context sharing, impersonation for custom authentication, transparent transactional support and painless migration to WCF in the future.
Also note that with the data portal you don't have to write code to copy the data into/out of your business objects (into your array/DataSet/hashtable/DTO/whatever), because that is done for you. If you use the shared interface approach, you'll have to manually write (or code-gen) code to get the data into/out of your business objects.
I did, btw, consider that approach for the framework when I first designed in in 1999-2000. But I rejected that idea, because it led to the same coding structure I used in VB6. And one of the primary sources of bugs in the VB6 approach was missing a field in this hand-crafted serialization code...
Ok, thanks for the answer, Rocky.
Well, all the clients will always call a method from a descendant from the same parent object, Entity. As the descendants will often change, and there will be a lot of new descendants, I shall have to often update clients. Have-you any advice about the better way to do that? The ideal solution would be that when a client connects to a server, it downloads and installs automatically new code, who could be in a new DLL. I know that is off topic, not really CSLA related, but any advice, from you or another reader, would be welcome.
Thanks a lot.
Richard
ClickOnce is the clear answer to this problem, as it is directly
supported by Microsoft and is an integral part of the .NET framework. You can
configure an application to require current code, in which case when the user
attempts to run the app, it will always download and install new code before
the app comes up.
Rocky
From: RichardETVS
[mailto:cslanet@lhotka.net]
Sent: Tuesday, June 19, 2007 7:06 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Remoting Questions
Ok,
thanks for the answer, Rocky.
Well,
all the clients will always call a method from a descendant from the same
parent object, Entity. As the descendants will often change, and there will be
a lot of new descendants, I shall have to often update clients. Have-you any
advice about the better way to do that? The ideal solution would be that when a
client connects to a server, it downloads and installs automatically new code,
who could be in a new DLL. I know that is off topic, not really CSLA related,
but any advice, from you or another reader, would be welcome.
Thanks
a lot.
Richard
Ok, thank to you both, I'll check that.
Richard
Copyright (c) Marimer LLC