CSLA-like remoting feature

Posts   
1  /  2
 
    
vicc
User
Posts: 1
Joined: 12-Nov-2004
# Posted on: 12-Nov-2004 16:37:32   

I would like to be able to do remoting with the adapter architecture in a simple way, similar to CSLA.

In CSLA, you can tell your app to remote to the DataPortal object simply by setting a few app.config settings. The CSLA DataPortal inherits from MarshalByRefObject.

I need to develop an application with two UIs - a web app and a win forms fat-client app. My plan is to have the web app access the DataAccessAdapter locally, while the Winforms app will access the DataAccessAdapter via remoting. The way I envision this is that both the web app and the winforms app will have references to the DataAccessAdapter, but I want the winforms app to remote to a hosted DataAccessAdapter over the network, similar to what can be done with CSLA.

My only problem is that the DataAccessAdapter does not inherit from MarshalByRefObject, therefore it cannot be remoted. I also do not have time to write a robust, remotable business layer that defines every single call to the DL that I would ever need (per the example in the customer section). The LLBL generated entities are good enough for me to use on this project.

Does anyone have an ideas on how I can do this? I have thought about writing a remotable wrapper to the DataAccessAdapter that provides the same functionality as every public method exposed by the "real" DataAccessAdapter.

Any comments, suggestions or help would be greatly appreciated.

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 12-Nov-2004 22:13:23   

Greetings,

I am finishing a CSLA warpper around LLBL objects utilizing ADAPTER. The two actually complement each other so perfectly that you would think the FRANS & ROCKY collaborated on the design, but I think this a pay back of following well know design patterns.

Before explaining how to approach this you have to understand the general architecture. CSLA is based on the pricipal of exposing public sharedservices to the UI (this is an industry best practice as you would see browsing some of the threads here at the Architecture forum). These service routines would call the client side DataPortal shared methods that decide to use either a local ServerDataPortal or a remote DataPortal (depending on the settings of your AppConfig or WebConfig). Once a ServerDataPortal method is called, it will use reflection with the help of the passed parameter (a criteria object or the BO object itself) to call the private methods of the business object in question (consult rocky's article at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet03262002.asp). These private methods would do the actual DataAccess work (be it ADO.NET or in our case LLBL code). To make LLBL's entity classes use the data portal in this fasion is not all that difficult as long as you understand what the DataPortal is really doing:

1- What will be utilized from the CSLA solution is CSLA, ServerDataPortal, ServicedDataPortal and the WebPortal (the C# bindable stuff is not needed here). The main classes needed in the CSLA project are the DataPortal, BusinessIdentity and BusinessPrincipal (and any support classes they are using). The other classes (BusinessBase, ...etc.) are not usefull with LLBL. You should customize a CSLA solution by removing all the extra functionality and keeping what you will be using

2- Create a LLBL designer project (CSLA.DAL for example) for the security tables that will be utilized in the table security used in CSLA. The two generated projects will be added to the CSLA solution. These two projects will be referenced by the CSLA project only! (CSLA project will also need to refernce LLBL's ORMSupportClasses DLL)

3- get the "Extended entity generator templates for Adapter" (from the 3rd party download site at LLBLGEN). Use these templates when generating all projects to be used by the new framework (including the security tables from step 2). This template generates extra classes in a folder (EntitySubClasses). These entity sub classes extend the entity classes generated by LLBL. These are going to be your Business Object classes. For example, when generating code for the table security (to be used in the CSLA solution itself) you will copy the generated (EntitySubClasses) folder from the DBGeneric project to the CSLA project (if you used CSLA.DAL as the root namespace for the LLBL project, you have to modify the name space in these entity subclasses from CSLA.DAL to just DAL). you must also copy the DeriveEntityFactory class from that project to the CSLA project also (remeber to adjust the namespace here and to remove these classes from the DBGeneric project). Now, all you table security code in BusinessIdentity should use LLBL code instead of ADO.NET code.

4- In solutions utilizing the modified CSLA framewrok, you will be using the DeriveEntity subclasses as you business classes. You must implement the follwing modifications for each class: * make all constructors private * create an embeded class CRITERIA that preferably inherits CRITERIABASE (see Rocky's lates CSLA Beta 1.5). A standard structure for the Criateria class is for it to have two constructores; one that takes the PK fields of your entity and the other takes a RelationPredicateBucket variable. This would allow the criteria to nicely enacpsolate LLBL's powerful RelationsPredicate bucket to perform any type of filtering * Write Public Shared service routines that expose the basic CRUD operations (I modified this so that I could write as many service routines as I want and not just basic CRUD). The code in these routines calls the appropiate routine in the DataPorat to perform the required CRUD operation. * Write a private non-shared routine for each public service routine. This private routine is what will be called by the Server DataPortal (local or remote is decided by the client DataPortal). The code in these private routines is standard LLBL code and not ADO.NET code as in CSLA.

There are some other areas that you have to consider but basically this how things will work. The resulting framework is basically CSLA's dataportal and table security married with LLBL's ORM functionality. As you must have noticed that a good understanding of CSLA's functionality and its plumbing will go along way in allowing you to build your CSLA-LLBL framework. I had fun doing it and I am hoping that FRANS would allow me to post my work for any CSLA veterans willing to integrate the power of LLBL...and beleive me ... its worth it (no more 1500+ store procedures and thats just the top of the iceburg simple_smile )

OMAR

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 13-Nov-2004 14:52:55   

I had fun doing it and I am hoping that FRANS would allow me to post my work for any CSLA veterans willing to integrate the power of LLBL...

Of course! simple_smile

Great posting, Omar, I couldn't have answered it better (also because I'm a complete CSLA newbie, I never had a look at it simple_smile )

An explanation for the reason that DataAccessAdapter isn't serializable is that it contains a live connection and it is common practise to encapsulate the DataAccessAdapter with a service API, avoiding the presence of a DataAccessAdapter on the network.

Frans Bouma | Lead developer LLBLGen Pro
IowaDave
User
Posts: 83
Joined: 02-Jun-2004
# Posted on: 01-Dec-2004 00:13:20   

Otis wrote:

I had fun doing it and I am hoping that FRANS would allow me to post my work for any CSLA veterans willing to integrate the power of LLBL...

Of course! simple_smile

Just curious... Omar, are you planning on posting your code?

I'm doing something similar and would benefit from your experience.

Thanks simple_smile

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 05-Dec-2004 18:56:23   

Just curious... Omar, are you planning on posting your code?

Yes.. I am just in the midst of a hand-over and hope to post my code sometime in the coming two weeks. I was hoping to finish earlier but those nasty issues that come up during implementation seem to never end cry

grant
User
Posts: 10
Joined: 10-Oct-2004
# Posted on: 10-Dec-2004 01:02:16   

omar wrote:

Just curious... Omar, are you planning on posting your code?

Yes.. I am just in the midst of a hand-over and hope to post my code sometime in the coming two weeks. I was hoping to finish earlier but those nasty issues that come up during implementation seem to never end cry

Did anything ever become of this? I'm guessing not...

AlexF
User
Posts: 7
Joined: 05-Jan-2005
# Posted on: 05-Jan-2005 16:09:26   

Dear Omar,

How's your CSLA wrapper around LLBL objects utilizing adapter going? Any new findings or ideas?

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 07-Jan-2005 02:34:39   

Just finished the LLBL templates today (including UI winforms classes). I will try to prepare some documentation to accompany the framework so as to explain the structure and how to best utilize the business objects

OMAR

cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 07-Jan-2005 05:50:39   

omar wrote:

Just finished the LLBL templates today (including UI winforms classes). I will try to prepare some documentation to accompany the framework so as to explain the structure and how to best utilize the business objects

OMAR

WOW! Thanks Omar stuck_out_tongue_winking_eye

swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 07-Jan-2005 14:28:02   

Hot dog! I can't wait! simple_smile

AlexF
User
Posts: 7
Joined: 05-Jan-2005
# Posted on: 10-Jan-2005 15:23:31   

This is going to be very interesting!

oarfish
User
Posts: 7
Joined: 17-Aug-2004
# Posted on: 13-Jan-2005 13:41:01   

Any new on this? am itching to see the code

Ryan

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 15-Jan-2005 19:50:07   

Sorry for the delay... I was tying up the last points to do with the WinUI framework.. I ask FRANS what is the best way to post this work

The goods are coming simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 16-Jan-2005 12:11:21   

omar wrote:

Sorry for the delay... I was tying up the last points to do with the WinUI framework.. I ask FRANS what is the best way to post this work

The goods are coming simple_smile

Best is to create a .zip file with a readme.txt and mail it to the support email address and I'll put it into the 3rd party section simple_smile Please state with it if you want to have your name and company mentioned as well.

You can also have them added to the subversion repository we have set up for templates, so others can develop them further. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
oarfish
User
Posts: 7
Joined: 17-Aug-2004
# Posted on: 24-Jan-2005 01:48:39   

Thought I'd give this thread a bump, as I am interested in using the CSLA dataportal in an upcoming project. Any news?

Ryan

AlexF
User
Posts: 7
Joined: 05-Jan-2005
# Posted on: 28-Jan-2005 15:11:16   

Hi Omar and all the people interested in what Omar has been doing with regards to making LLBLGen and CSLA work together,

It is just another bump to this thread... Any news?

oarfish
User
Posts: 7
Joined: 17-Aug-2004
# Posted on: 28-Jan-2005 15:45:03   

I have been working on a set of templates to integrate llblgen and CSLA, they are exceedingly rough at the moment, but I have CRUD operations remoting correctly for Entities and a corresponding set of mbUnit tests (which don't yet constuct appropriate related entities, so blow up on foriegn key constraints - stupid tests). Still have much to do - derived entity collections , CSLA business rule stuff, changing the CSLA undo functions to use llblgen's field data versioning, remoting unitofwork, remoting sprocs..

Obviously, I would like to see an intergrated transparent remoting framework in some future version of llblgen, it would be a killer feature. ( For me at least, as I am a lazy sod).

If I get something together that it publicly releasable without too much danger of being embarrisingly hacky, i'll release it.

Ryan

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 29-Jan-2005 13:07:13   

I just finished preparing the documentation and the source code as well as the LLBL templates and task performers. I don't know how I should post this so I will e-mail FRANS for help...

OMAR

Update: I can't find FRANS's e-mail anywhere in this forum. Can anyone pass on his e-mail please

Thanks simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 29-Jan-2005 13:48:27   

support AT llblgen.com will do simple_smile I'll then see if I can upload it this weekend simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 01-Feb-2005 11:44:15   

It's live! See the 3rd party section.

Thanks a lot for this contribution to the community, Omar (and thank Bashar for me simple_smile )!

Frans Bouma | Lead developer LLBLGen Pro
AlexF
User
Posts: 7
Joined: 05-Jan-2005
# Posted on: 02-Feb-2005 03:44:19   

Omar and Bashar,

You are great. Thank you for sharing this with all of us.

Frans, thank you for supporting this effort.

free4all
User
Posts: 35
Joined: 12-Sep-2003
# Posted on: 02-Feb-2005 14:33:45   

I know very little about CLSA, not read the book only picked up snippets off the web. What I'm wondering is it only useful when you need remoting or is it a fully functioning business layer in its own right?

When I got a chance I was going to take a look at the custom business manager templates currently being developed in the "Template Studio and Custom Templates" forum" are the new CLSA or JCL templates just released going to do the same job?

If they are doing the same job which one am I better off using?

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 02-Feb-2005 17:24:15   

I have ordered the book "Expert C# Business Objects" to start looking at CSLA. Meanwhile, I'm working with a firm in Argentina that co-wrote something called MBI (Microsoft Business Integrator) and they want to use that for my project (they also use NHibernate for ORM, but I am dictating we will use LLBLGenPro instead).

Anybody know anything about MBI??

AlexF
User
Posts: 7
Joined: 05-Jan-2005
# Posted on: 02-Feb-2005 18:02:00   

Hi Omar,

I have a question for you: Was there a particular reason to use self-servicing scenario in the JCL implementation you've provided us with? If there was none, what are the implications of using the Adapter? Your input on this is very appreciated. Once again, thank you for the great job you have done.

AlexF
User
Posts: 7
Joined: 05-Jan-2005
# Posted on: 02-Feb-2005 18:08:01   

Omar,

Please scrap my last post: I keep reading the docs, and now I am in the Part II. flushed

1  /  2