Reuse Business Objects for a server application

Reuse Business Objects for a server application

Old forum URL: forums.lhotka.net/forums/t/4198.aspx


mickeymouse posted on Saturday, January 19, 2008

Hello,

I would like to use CSLA for a new Windows Form application( front end application).
But in the same time I would like to reuse the B.O. (Business Objects ) created for the WinForm application for server application ( windows service application)
These two applications will not communicate together.
But the WinForm & server application will share most of the same business context .

The server will communicate with another server via his own interface protocol.

The server application will not have these 2 logical layers : UI & Presentation.

So my question is : can I reuse some of the business objects used by the WinForm  Application for the server application ?

I wondering if the code implementation for the UI layer inside of the B.O. can be a issue when I will reused them for the server Application ?
Can CSLA framework be used between servers application ( only three layers : Business Logic, Data Access, Data Storage) .
 
Thanks

JohnB replied on Saturday, January 19, 2008

Mickeymouse,

You can use your BO for your server application as well as any other application that has the need to implement those business functions.

Not really sure what you're asking here: "I wondering if the code implementation for the UI layer inside of the B.O. can be a issue when I will reused them for the server Application ?"

Your business objects do not contain any UI related code. You will interact with your business objects via factory methods and properties etc.

John

mickeymouse replied on Saturday, January 19, 2008

Not really sure what you're asking here: "I wondering if the code implementation for the UI layer inside of the B.O. can be a issue when I will reused them for the server Application


I was asking this question because the CSLA B.O. support Win Forms data binding natively for I.E. PropertyChanged or IDataErrorInfo so I would like to know the impact if you do not use Ui & Presentation Layer.

But I think If I don't use a UI layers,  the csla implementation code for the
IDataErrorInfo will never by call for example.
Also I think all the data Binding interface implementation will not be call also.

JohnB replied on Saturday, January 19, 2008

I understand what you're asking now. I don't believe that you will have any problems with what you're trying to do. We are doing something similar where we are using the same business objects that we have in our WinForm application in several services applications that require the same objects.

You did not mention if you were creating BusinessBase objects with validation rules but you may be able to use ReadOnlyBase objects for what you're trying to do which do not support PropertyChanged. Just a thought...

John

RockfordLhotka replied on Sunday, January 20, 2008

mickeymouse:

I wondering if the code implementation for the UI layer inside of the B.O. can be a issue when I will reused them for the server Application ?

If you designed your objects around use cases then this tends to work pretty well. If you designed your objects around the database (which I don't recommend) it can still work pretty well. If you designed your objects to specifically support one particular UI (mixing UI requirements into the business layer) then it can be harder.

mickeymouse:

Can CSLA framework be used between servers application ( only three layers : Business Logic, Data Access, Data Storage) .

Yes, but you really do have a "UI" - your service itself is an interface to the business objects. What you are doing is basically the same as what I describe in Chapter 11, except that you are creating your own proprietary network protocol instead of using HTTP/SOAP. But architecturally it seems like you are describing exactly the same thing.

Copyright (c) Marimer LLC