By Alan P Bourke - 2/2/2009
Does anyone have a quick example of how to leverage an BO as defined in an external BO Library from within an non-UI application, such as a Console application ? I presume if the BO is configured and working within it's own BO LIbrary project then I should be able to reference the DLL and use it without having to manually implement SetDataSources et al ?
I can see various postings skirting round the issue on the forum but no concrete examples.
Many thx in advance ...
|
By Trent L. Taylor - 2/2/2009
You can most definitely do this and there really isn't much to explain other than the following:
|
By Alan P Bourke - 2/2/2009
Thanks. I guess I have a gap in my understanding thus far - I assumed that the BO would know how to connect to the data already without having to set up a data source.
Ah well, onward ...
|
By Greg McGuffey - 2/2/2009
The basic architecture allows for BOs to be loosely coupled to the data source. I.e. this allows you to hot swap datasources on the fly as needed (like you might do if you provide online/offline data access or if you have some sort of fall back database server). Also, this allows for many BOs to share the same data source. The datasource encapsulates the connection info, while the BO encapsulates data access and business rules.
Is that making more sense?
|
By Alan P Bourke - 2/2/2009
Absolutely, thanks Greg.
|
By Greg McGuffey - 2/3/2009
Glad it helped!
|
By Richard Keller - 2/3/2009
Create a Root Business Object and have all your BO's Inherit from it with your connection string. What we do is provide a utility that sets the Connection although it is in a Non-UI Configuration. The Root BO knows how to connect and cascades down to the LocalHost embedded string if not connected. We also add a few other functions that are used all the time like a FIllAllRecords Data Retrieval Method.
|