| | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: Today @ 2:01:30 PM Posts: 372, Visits: 2,492 |
| | Trent or Ben, I have written a VS add in that is like a cheap knockoff of the BO mapper except it creates what I call 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. '------------------------------------------------------------------------------' <auto-generated>' This code was generated by a tool.' Runtime Version:2.0.50727.42'' Changes to this file may cause incorrect behavior and will be lost if' the code is regenerated.' </auto-generated>'------------------------------------------------------------------------------Option Strict OnOption Explicit OnImports SystemNamespace ActionLabor.Test.QueryObjects<Serializable()> _ Public Class QOCustomerPrivate _Customer As String'Default constructor supports serializationPublic Sub New()MyBase.New()End SubPublic Sub New(ByVal _Customer As String)MyBase.New()Me._Customer = _CustomerEnd SubPublic ReadOnly Property Customer() As StringGetReturn _CustomerEnd GetEnd PropertyEnd ClassEnd NamespaceCurrently I am using this queryobject 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 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.Public Sub testreport() Me.FillDataTable("Select cuname as [Customer] from Customer") Dim rpt As New TestReport rpt.DataSource = Me.CurrentDataTable rpt.ShowPreview() End SubThis scenario seems to work out well so far 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 tightly bound. Anyways hope this makes sense to you cause sometimes I confuse myself. But I am having fun figuring out how to do these things in .Net  Thanks alot Paul |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: Today @ 2:01:30 PM Posts: 372, Visits: 2,492 |
| Evidently I did confuse you guys. Basically this is what I am thinking.A business object 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. ? However after trying to get a fairly complex report designed and 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 class for me. I added to it Visual Studio as an add-in and it works fine. 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. This design works fine however I would like to take it one step further and eliminate the BO from the equation and just be able to retrieve the data without having to use a business object I have no need for it in this instance. I could then figure out how to make my object "data aware" and be able to use it directly as a read only bindable object. Is the line below correct for what I want to accomplish>? It seems to work ok but want to make sure that that is the correct entrypoint. Dim loTable As DataTable = DataBasics.DataSources("").GetDataTable(loCmd, Nothing) 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. Paul |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 12/09/2008 3:36:08 PM Posts: 2,686, Visits: 1,891 |
| Yes, directly accessing the DataSources collection is the way you want to do that 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.
www.bungie.net |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: Today @ 2:01:30 PM Posts: 372, Visits: 2,492 |
| | Thanks Ben, I was hoping that was correct as I have almost finished working on creating this type. well the first version anyways. |
| |
|
|