﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Generic BO?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 10 Jun 2026 18:44:00 GMT</lastBuildDate><ttl>20</ttl><item><title>Generic BO?</title><link>http://forum.strataframe.net/FindPost25472.aspx</link><description>My application can read a user defined database whose structure is not known until runtime. A separate application allows the user to create the database and saves information in a known configuration database&amp;nbsp; which comprises the field names and the type of controls to be created on the WinForm top display the data. I'm not sure where to start to create a generic BO (if possible) that can perform the CRUD operations on the 'unknown ' database structure. Can anyone point me in the right direction,&lt;P&gt;Many thanks for your time</description><pubDate>Thu, 07 Jan 2010 08:39:20 GMT</pubDate><dc:creator>Ian Hammond</dc:creator></item><item><title>RE: Generic BO?</title><link>http://forum.strataframe.net/FindPost25490.aspx</link><description>Let us know if you still need a bit more direction.  Thanks for all of the participation out here guys.</description><pubDate>Thu, 07 Jan 2010 08:39:20 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Generic BO?</title><link>http://forum.strataframe.net/FindPost25478.aspx</link><description>Hi Guys,&lt;/P&gt;&lt;P&gt;Thank-you both for responding to my query. I would agree that Les's solution does seem to be more straight forward but limited to SQL Server, but I'm sure it possible to extend this. I did look at the code generated by the BOM and wondered if it were possible to write a generic version, but it's only a fledgeling thought at the moment. I'm still considering my options.</description><pubDate>Mon, 04 Jan 2010 10:54:51 GMT</pubDate><dc:creator>Ian Hammond</dc:creator></item><item><title>RE: Generic BO?</title><link>http://forum.strataframe.net/FindPost25477.aspx</link><description>Ian,&lt;br&gt;
&lt;br&gt;
It [i]might[/i] be possible, but I'm not sure if it's a good idea. The place to start is to look at the designer code of a BO Mapper generated BO. This will give you an idea of what is needed.  Many of the public methods within the designer file could be pretty easily modified to just get meta data from a table (like the database name, the table name, list of fields). However, some are going to be hard, like the enum of field names. Some are going to be very hard, like the static lists and property descriptors. I'm not sure what exactly is necessary to get CRUD working (i.e. maybe the enum isn't strictly necessary...don't know) and what exactly is necessary to manage binding.  &lt;br&gt;
&lt;br&gt;
I didn't look into this real deeply, but I think Les is likely suggesting a better path of just using native ADO.NET with native .NET binding functionality in a situation like this.  I'll be interested to hear what you discover and decide to use.</description><pubDate>Mon, 04 Jan 2010 09:42:18 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Generic BO?</title><link>http://forum.strataframe.net/FindPost25473.aspx</link><description>Dear Ian,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; StrataFrame is designed to work within the IDE. However, you can use the native DataAdapter technology&amp;nbsp;to build commands on the fly.&amp;nbsp;&amp;nbsp;I used VB for no particular reason, and I've assumed your data is stored in SQL Server tables, again just to build an example; the other data alternatives have analogs:&lt;/P&gt;&lt;P&gt;Imports System.Data.SqlClient&lt;/P&gt;&lt;P&gt;Public Class Form1&lt;/P&gt;&lt;P&gt;&amp;nbsp; Public da As SqlDataAdapter&lt;BR&gt;&amp;nbsp; Public cn As SqlConnection&lt;BR&gt;&amp;nbsp; Public cb As SqlCommandBuilder&lt;BR&gt;&amp;nbsp; Public cs As String = "your connection string here"&lt;/P&gt;&lt;P&gt;&amp;nbsp; Private Sub Form1_Load( _&lt;BR&gt;&amp;nbsp;&amp;nbsp; ByVal sender As System.Object, ByVal e As System.EventArgs) _&lt;BR&gt;&amp;nbsp;&amp;nbsp; Handles MyBase.Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cn = New SqlConnection(cs)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cn.Open()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; da = New SqlDataAdapter("SELECT * FROM Table", cn)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cb = New SqlCommandBuilder(da)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; da.DeleteCommand = cb.GetDeleteCommand()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; da.UpdateCommand = cb.GetUpdateCommand()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; da.InsertCommand = cb.GetInsertCommand()&lt;/P&gt;&lt;P&gt;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;End Class&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; However, this couples your connection and SQL to the application, which compromises maintainability. But if that's what you need to do, it is possible.&lt;/P&gt;&lt;P&gt;Les</description><pubDate>Mon, 04 Jan 2010 08:03:52 GMT</pubDate><dc:creator>Les Pinter</dc:creator></item></channel></rss>