How To - Completely non-UI use of BOs.


Author
Message
Alan P Bourke
Alan P Bourke
StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)
Group: Forum Members
Posts: 7, Visits: 12
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 ...
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You can most definitely do this and there really isn't much to explain other than the following:

  • Add a reference to your BO library within your console app
  • It will also require a reference to the MicroFour StrataFrame Base and MicroFour StrataFrame Business assemblies
  • Next, you will need to setup your datasources prior to attempting to execute a query on the BO.  This is generally done in the program.cs or Appmain.vb files in the SetDataSOurces method in a standard SF app.  But all you need to do is setup the datasource manually prior to executing queries on the BO.

    MicroFour.StrataFrame.Data.DataBasics.DataSources.Add(New SqlDataSourceItem("","MyConnectionString"))

Alan P Bourke
Alan P Bourke
StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)
Group: Forum Members
Posts: 7, Visits: 12
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 ...
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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?
Alan P Bourke
Alan P Bourke
StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)StrataFrame Beginner (7 reputation)
Group: Forum Members
Posts: 7, Visits: 12
Absolutely, thanks Greg.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad it helped!
Richard Keller
Richard Keller
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 84, Visits: 324
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.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search