StrataFrame Forum

Plug-In Architechture - Using Strataframe in Dynamic Enviroment

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

By Richard Keller - 1/18/2008

I am looking for an approach to Datasource access with using a Strataframe BO in another plug-in enviroment ( these enviroments dynamically load assemblies using CreateInstance ).   The BO may be called from a Form or User Object and configuration of the Datasource connection string would be done prior to usage.  Maybe Ben or Trent have an idea here.   My question is where should I have the Datasource logic placed?  

The first option that came to mind is to modify my base business object to instantiate the Datasource if it is not found.  I can do this through a shared class, module, etc. if necessary.  This would work like the way the AppMain functions and loads the Exeception and Datasource objects.   Any comments, ideas, etc?

Thanks,

Richard

By Trent L. Taylor - 1/18/2008

My question is where should I have the Datasource logic placed?

It looks like you have the right idea.  The DataSources is a shared collection, so you could create a base BO that all of your business objects inherit from.  In the constructor of the BaseBO, you could then test to see if the connection string(s) have been created:

If Not MicroFour.StrataFrame.Data.DataBasics.DataSources.ContainsKey("") Then
    '-- Add your data source to the collection
End If

But it looks as though you were already heading down the right road Smile