StrataFrame Forum

Running a BO process from outside my SF app. ( like a VFP app as com object )

http://forum.strataframe.net/Topic31139.aspx

By Charles R Hankey - 4/17/2012

If I have an SF C# app connected to SQL Server and there is process in a business object that interacts with other business objects and changes data :

In my SF UI the interaction of the BOs is done in a winform code. 

The connections are made in the startup of the app. 

How would I call this same BO process from outside of my SF app ( or automatically run my SF app to invoke that process with no UI ) and take advantage of connections and bo interaction etc ? 

The idea is that a backnend process is going to run an SSIS package to get CSV data into a staging table ( one of the bos in my app ) and then bo logic is going to create or update reocords in three other tables based on the new staging records. 

I may also want to pass into the app the id of the staging record batch to process.

Suggestions greatly appreciated.
By Ivan George Borges - 4/17/2012

Hi Charles.

The BOs should be in a library of itself, so you can reference this DLL in as many projects as you need.
The connection string can be shared by many EXEs. Just set the ConnectionManager.ApplicationKey to the same key and they will share the same connection originally set.
By Fabian R Silva, - - 4/19/2012

Greetings, after you call SetDataSources() can call anything you want before that.  I still not implemented  this but I suppose that this can work....


For example in c#: you can call the exe with a parameter from a bat if you like, to do this you have to add an "args" string array as a string[] parameter on program.cs (something like that in vb, check creating an application console and check how do it VB)

in c#
static void Main(bstring[] args) <-- this is the starting point of the app, I added string[] args array to receive a parameter with name of the process that wants to execute...

put the value of args[0] on a static public "callerArgument" property and when StrataFrame event SetDataSources() is called, at the end of this method you can see the callerArgument property and if it have some string, call a method that do the processing that you want.

after you call your processing method you can call
Environment.Exit(0);
to exit from the exe without do anything more.

As Ivan says, it too can be accomplished creating another project (can be an console app) and adding the dll references to the BOs library(s) projects/dlls needed.

By Charles R Hankey - 4/19/2012

Thanks guys, as soon as I got the idea of console app and BO library into my head ( as well as searching here for the connection info etc) I started to fall into place - except that now management wants me to do it all from within my SSIS package with SPs.  Oh well.
By Ivan George Borges - 4/19/2012

Great Charles. Come back here if you need anything else.