By Chan - 9/19/2007
Hi,
In my custom field, I have code to retrieve data from backend db. Currently, I am using sqlCommand object and pass it to BO.ExecuteScalar().
I was thinking to make it generic, so that it won't be too painful if I switch db.
Any ideas?
Thank you
|
By Trent L. Taylor - 9/19/2007
This is basically the approach that we have taken on some of our classes within the framework such as the QueryInfo and some other base classes. Also, in our medical software we have some classes that are used for different databases such as SQL and VFP (for the older tables) but use the same classes. Rather than using a Generic, we will create a class that we can pass over a DbCommand then based upon which database we will talk to will make any adjustments to the command (i.e. VFP requires an ORDER BY when using the TOP statement, etc) before executing the query. This can become a very long topic, but yes, it is possible to create a class so that you can write your BO logic in a more "generic" manner so that you can swap back-end databases, but it will require some effort on your part up front to create the classes that will house this logic.
|
By Chan - 9/19/2007
Hi,
Any plan to bundled the "general data class" to SF?
|
By StrataFrame Team - 9/20/2007
In the next version, that is the functionality that LINQ will provide. It would require the ability to build a query as a tree of objects that describe the query which would then be translated into the proper SQL syntax by the provider specific attachment. The expression tree is exactly what LINQ provides, so we're waiting for the next major version of SF to implement the functionality.
|
|