﻿<?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?)  » Accessing the Data Access Layer Directly</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 17:45:18 GMT</lastBuildDate><ttl>20</ttl><item><title>Accessing the Data Access Layer Directly</title><link>http://forum.strataframe.net/FindPost3688.aspx</link><description>Trent or Ben,&lt;P&gt;I have written a VS add in that is like a cheap knockoff:D of the&amp;nbsp;BO mapper except it creates what I call&amp;nbsp;a "QueryObject". Basically it generates an entity object based on the fields in a select statement. I did this to allow me to have design time support for reports for joined tables etc without having to create dummy table and monkey with getting a business binding source to work on an xtra report.&amp;nbsp;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'------------------------------------------------------------------------------&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' &amp;lt;auto-generated&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' This code was generated by a tool.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' Runtime Version:2.0.50727.42&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' Changes to this file may cause incorrect behavior and will be lost if&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' the code is regenerated.&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;' &amp;lt;/auto-generated&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'------------------------------------------------------------------------------&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;Option&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Strict&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;On&lt;/P&gt;&lt;P&gt;Option&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Explicit&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;On&lt;/P&gt;&lt;P&gt;Imports&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; System&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;Namespace&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; ActionLabor.Test.QueryObjects&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;Serializable()&amp;gt; _&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Class&lt;/FONT&gt;&lt;FONT size=2&gt; QOCustomer&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;FONT size=2&gt; _Customer &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'Default constructor supports serialization&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt;()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;MyBase&lt;/FONT&gt;&lt;FONT size=2&gt;.New()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; _Customer &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;MyBase&lt;/FONT&gt;&lt;FONT size=2&gt;.New()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;._Customer = _Customer&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ReadOnly&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Property&lt;/FONT&gt;&lt;FONT size=2&gt; Customer() &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Get&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; _Customer&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Get&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Property&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Class&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Namespace&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;Currently I am using this queryobject&amp;nbsp;as a dummy class just to be able to more easily design reports. At runtime I have a single BO that is "In Charge" of the data access and I call a method on the bo that displays a parameters form if needed then retrieves the data and&amp;nbsp;swap's the reports Datasource from the dummy object to the BO's current datatable. or alternatly I could call the report directly from the application.&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; testreport()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.FillDataTable(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"Select cuname as [Customer] from Customer"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; rpt &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; TestReport&lt;/P&gt;&lt;P&gt;rpt.DataSource = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentDataTable&lt;/P&gt;&lt;P&gt;rpt.ShowPreview()&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;This scenario seems to work out well so far&amp;nbsp;but then as usual I got to thinking about having this object able to retrieve it's own data without breaking encapsulation etc. Is this possible or even worthwhile for me to attempt? I poked around briefly and it looks like it would be difficult as the data access and bo layers look to be&amp;nbsp;tightly bound.&lt;/P&gt;&lt;P&gt;Anyways hope this makes sense to you cause sometimes&amp;nbsp;I confuse myself. But&amp;nbsp;I am having fun figuring out how to do these things in .Net :w00t:&lt;/P&gt;&lt;P&gt;Thanks alot&lt;/P&gt;&lt;P&gt;Paul</description><pubDate>Fri, 20 Oct 2006 08:55:48 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: Accessing the Data Access Layer Directly</title><link>http://forum.strataframe.net/FindPost3707.aspx</link><description>Thanks Ben,&lt;/P&gt;&lt;P&gt;I was hoping that was correct as I have almost finished working on creating this type. well the first version anyways.</description><pubDate>Fri, 20 Oct 2006 08:55:48 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: Accessing the Data Access Layer Directly</title><link>http://forum.strataframe.net/FindPost3706.aspx</link><description>Yes, directly accessing the DataSources collection is the way you want to do that :)&amp;nbsp;&amp;nbsp;Any time you need to execute something on the database and don't have a business object or don't want to use a business object, then you can use the methods that exist directly on the data source.</description><pubDate>Fri, 20 Oct 2006 08:42:12 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Accessing the Data Access Layer Directly</title><link>http://forum.strataframe.net/FindPost3704.aspx</link><description>Evidently I did confuse you guys.:w00t:&lt;/P&gt;&lt;P&gt;Basically this is what&amp;nbsp;I am thinking.A business object&amp;nbsp;represent's a single table. It has to represent a single table in order to provide inserts update and deletes as well as all the goodies such as required fields, business logic rule handling etc. ?&lt;/P&gt;&lt;P&gt;However&amp;nbsp;after&amp;nbsp;trying to get a fairly complex report designed&amp;nbsp;and&amp;nbsp;trying many different things I realized that what I really wanted was a strong typed object that represented the schema of a SQL Select. I then dug in and created a class generator that creates this dummy&amp;nbsp;class for me. I added to it&amp;nbsp;Visual Studio as an add-in and it works fine. &lt;/P&gt;&lt;P&gt;Currently My Solution has 3 projects the Main project a BO project and a Reports project. In the Reports project I use the dummy class I create to create a design time data source of a Select Statement. In the Reports project I have a single BO that I use just to perform a select statement ,return a table and swap the reports datasource. &lt;/P&gt;&lt;P&gt;This&amp;nbsp;design works fine however I would like to take it one step further and eliminate the BO from the equation and&amp;nbsp;just be able to&amp;nbsp;retrieve the data without having to use a business object&amp;nbsp;I have no need for it in this instance. I could then&amp;nbsp;figure out how to make my object "data aware" and be able to use it directly as a read only&amp;nbsp;bindable object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Is the line below correct for what I want to accomplish&amp;gt;? It seems to work ok&amp;nbsp;but want to make sure that that is the correct entrypoint.&lt;/P&gt;&lt;P&gt;Dim&amp;nbsp;loTable As DataTable = DataBasics.DataSources("").GetDataTable(loCmd, Nothing)&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this post makes more sense as to what I am doing and why I am doing it. I think that bindable read only strong typed query object is a good thing to have available but if you guys can think of anything wrong with what I am doing I'd like to know what you think.&lt;/P&gt;&lt;P&gt;Paul</description><pubDate>Thu, 19 Oct 2006 22:42:28 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item></channel></rss>