Extending Component Class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pantichd

    #1

    Extending Component Class

    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.Componen tModel.Componen t) 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 'LayerDataAcces s.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.


Working...