By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,996 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,996 IT Pros & Developers. It's quick & easy.

Extending Component Class

P: n/a
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.
Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Have you actually compiled the BaseDAO before you created the sub-class ?

Angel
O:]

"pantichd" <pa******@firstenergycorp.com> wrote in message
news:uk**************@TK2MSFTNGP15.phx.gbl...
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.

Jul 21 '05 #2

P: n/a
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!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3

P: n/a
When working with a custom component/control in the designer, you need to
build a design version and a reun-time version of the obejct.

Here is a link overviewing the process.

http://msdn.microsoft.com/library/de...log_editor.asp

Hope it helps.

--tpt

"David Pantich" wrote:
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!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.