473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using Interface with central "DAL"

I'm working on a new DAL for my latest project. As the performance is essential I'm avoiding late binding/reflection as much as possible.

One central part is the DAL function for populating Business Objects. One class is called in order to connect to the database with the given SQL (stored procedures can't be used in this environment) and the given Business Object or List is populated. As different Business Object types will be populated by the same function I made an Interface that all of the Business Objects implements with the Sub called "Fill". The question is - will reflection be used in this scenario? My thought was as I'm "describing" the objects trought the interface the compiler doesn't need to use Reflection. Perhaps I'm all wrong here..

Simplified code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Object Handler:
  3.  
  4. With New DAL.DataManager
  5.      .Populate(Of T)(sSQL)
  6. End With
  7.  
  8. Business Objects:
  9.  
  10. Public Class Customer
  11.      Implements DAL.EntityInterface
  12.  
  13.      Public Sub Fill(Reader as sqlClient.SQLDataReader) Implements DAL.EntityInterface.Fill
  14.  
  15.             CustomerID = Reader.Item("CustomerID"))
  16.             CustomerName = Reader.Item("CustomerName"))
  17.             ... and so on
  18.      End Sub
  19. End Class
  20.  
  21. Interface:
  22.  
  23. Namespace DAL
  24.     Public Interface EntityInterface
  25.         Sub Fill(Reader as sqlClient.SQLDataReader)
  26.     End Interface
  27. End Namespace
  28.  
  29. DataManager:
  30.  
  31. Public Class DataManager
  32.      Public Function Populate(Of T As {DAL.EntityInterface, New})(ByVal sSQL As String) As T
  33.  
  34.      Reader = New DAL.GetReader(sSQL)
  35.           If Not IsNothing(Reader) Then
  36.                Populate.Fill(Reader)
  37.           End IF
  38.      End Function
  39.  
  40. End Class
  41.  
So with other words, I want to have many different Business Objects (Class definitions with Public Properties) and each Business Object Type has it's own Handler Class that will call DAL and with provided SQL DAL will create the corresponding Business OBject and fill it using the Sub defined in the Interface. And this without using Reflection (or at leats not any expensive Reflection). Any thought or alternative solutions? The important part is that I don't want to separate Business Object Handlers(SQL etc), Business Objects (Class definitions) from DAL but still get good performance.

Thanks in advance!

Regards
Tom
Oct 13 '10 #1
0 877

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Luc Dal | last post by:
Hello, I've serious problem using ASP under WindowsXP sp2. I get the following reply (sorry it's in french) Erreur de compilation Microsoft VBScript error '800a0401' Fin d'instruction...
3
by: Mark | last post by:
Hello, Recently I have not been able to open an asp.net page in MDE's web from designer. I recieve the following error: "The file failed to load in the web from designer. Please correct the...
4
by: Alex Maghen | last post by:
This is weird On my WinXP development box, database calls made from within my GLOBAL.ASAX go to SQLServer as user "ASPNET" even though I have impersonation turned on in my web.config. That's fine...
4
by: spamfurnace | last post by:
Hi there. Ive just been reading about the Whidbey Provider Pattern on MSDN, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp02182004.asp and i wanted to...
4
by: dbuchanan | last post by:
Hello, I have an audit table into which I insert information about the use of the application. This works sometimes and other times fails. I cannot find any reason for it failing. It is always...
10
by: mcbobin | last post by:
Hi, Here's hoping someone can help... I'm using a stored procedure to return a single row of data ie a DataRow e.g. public static DataRow GetManualDailySplits(string prmLocationID, string
4
by: Burt | last post by:
I'm working on a Windows app that pulls data from SQL Server, displays it on various forms and grids, and allows the user to update, insert, delete data. Some but not much business logic, just...
2
by: Ronald S. Cook | last post by:
In trying to figure out how to make function MedicineClass.ApplyMedicinePriceChanges perform better, I ran Code Analysis and got the following: ...
1
by: Fresno Bob | last post by:
Hi I'm creating a data access layer in which each object maps onto a database table. I will also be creating basic methods that return the object by primaryid and perform insert and update...
6
by: Bobby Edward | last post by:
Using ASP.NET 3.5 and MySQL (thru DevArt MyDirect.NET)... On the production server I get a "Parser Error" for every XSD dataset. It works perfect on my dev machine. But, on the production...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.