Question about Inheritance

G

Guest

Hi,

I have a web application which accesses the data base. So I created a
dataaccesslayer project which has a separate class for each table. I have
also created a business layer to access these classes so that I can only
refer to the business layer from web project. I used inheritance in the
business logic classes to import the properties of the dataaccesslayer class
.. since I am not referring to the dataaccesslayer from web project the
compiler is giving an error when I try to run the application. Is there a
solution for this with out creating all the properties and methods in the
business layer? Following is the sample code that exemplifies what I am
trying to do.

' Inside web form

Dim objProducts as ProductsDTO = New ProductsDTO("1")
Dim productId as string = objProducts.ProductId

' Inside business logic

public class ProductsDTO
Inherits Products

public sub New(CustomerId)
MyBase.New(customerId)
End sub


'Inside DataAccessLogic

public class Products

private sub productId

public sub New(CustomerId)
Dim dtProduct as datatable

dtProducts = GetProductFromDB(CustomerId)
if not dtProducts is nothing
productId = dtProducts.rows(0).Item(ProductId)
end if
End sub

Please let me know.

Thanks,
sridhar.
 
G

Guest

Sridhar

I usually return a reader or datatable from my data access and then loop
through the reader in my business logic and assign it to the entitiy
property.

Are you getting a circular reference error? What is the actually compiler
error?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top