Extending Component Class

P

pantichd

Hello,

I'm using a Component Class object to represent a database table. This Data
Access Object (DAO) has a connection object and data adapter object in it
along with a bunch of methods that need to be there every time I create a
new DAO to represent a db table.

Instead of having to code that "common" logic for each new class I'd like to
create a base DAO, put the common logic there and inherit from it (instead
of System.ComponentModel.Component) for each new DAO.

My current steps for creating a new DAO are:
1) Create a new Component Class object
2) Drag the database from the Server Explorer onto the design pane. This
creates the connection object to the db.
3) Drag a table from the database in Server Explorer onto the design pane.
This creates the data adapter object for that table.
4) Create all the common methods in the new DAO

Within an application, each DAO will have the exact same connection object
so I'd like to include that in the base DAO.

Thinking along those lines, I created a new DAO (call it BaseDAO) and did
steps 1, 2 & 4 from above. Then I created another DAO (ChildDAO) that
inherits from the BaseDAO. I was hoping that I would then be able to just do
step 3 from above for this new DAO.

When I try to bring up the designer for ChildDAO I get the following error:

The designer could not be shown for this file because none of the classes
within it can be designed. The designer inspected the following classes in
the file:

ChildDAO --- The base class 'LayerDataAccess.BaseDAO' could not be
loaded. Ensure the assembly has been referenced or built if it is part of
the project.

Both the BaseDAO and ChildDAO objects are in the same project. Does anyone
have any ideas what I'm doing wrong?

Thanks in advance for any help.

David.
 
A

Angelos Karantzalis

Have you actually compiled the BaseDAO before you created the sub-class ?

Angel
O:]
 
D

David Pantich

Yes, the base class compiled fine. So did the child class.

The error happens when I try to open the Designer on the child class.

Thanks!
 

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