Accessing the Data Access Layer Directly


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Trent or Ben,

I have written a VS add in that is like a cheap knockoffBigGrin 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 On

Option Explicit On

Imports System

Namespace ActionLabor.Test.QueryObjects

<Serializable()> _

Public Class QOCustomer

Private _Customer As String

'Default constructor supports serialization

Public Sub New()

MyBase.New()

End Sub

Public Sub New(ByVal _Customer As String)

MyBase.New()

Me._Customer = _Customer

End Sub

Public ReadOnly Property Customer() As String

Get

Return _Customer

End Get

End Property

End Class

End Namespace

Currently 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 Sub

This 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 w00t

Thanks alot

Paul

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search