BO library compile-time errors

BO library compile-time errors

Old forum URL: forums.lhotka.net/forums/t/871.aspx


albruan posted on Thursday, August 10, 2006

I'm encountering multiple errors while trying to compile my BO library and all the errors that get thrown by the compiler are all related, but I can't figure out the solution.

Basically, I have a child Department object to handle adding/deleting/updating a Department in a project.  This Department object has three distinct child collections of Drawing, Category, and Qualification objects.  The errors I'm encountering are showing up in the Update method in the collection object itself; in other words, for Drawing, it's showing up in the Update method for the Drawings object.  Typical code is as follows:

   private void Update(SqlTransaction tr, Department parent)
   {
      RaiseListChangedEvents = false;

      foreach(Drawing deletedChild in DeletedList)
         deletedChild.DeleteSelf(tr);
      DeletedList.Clear();

      foreach(Drawing child in this)
      {
         if (child.IsNew)
            child.Insert(tr, parent);
         else
            child.Update(tr, parent);
      }

      RaiseListChangedEvents = true;
   }

The errors are getting thrown in the child.Insert and child.Update steps.  The error message I'm getting is:

   Argument '2': Cannot convert from 'Library.Department' to 'Library.Drawings'

I've been staring at it for so long...switching from the Department object to the Drawings object to the individual Drawing objects...but I can't find what's causing this compile-time error to be thrown.  Is there any specific place I should check?

RockfordLhotka replied on Thursday, August 10, 2006

What does the Drawing.Update() method look like? Specifically, what type does it expect 'parent' to be? Given this code, 'parent' would need to be of type Department in the Drawing.Update() method.

albruan replied on Thursday, August 10, 2006

Thanks, Rocky!  You're a lifesaver!  The heat down here must be getting to me <g>, even though it hasn't been as hot here as it was up there in MN last week.  Anyway, I was telling the Drawings object that its parent was the Department object and I was telling the Drawing object that it's parent was the Drawings object.  Everything is working super now.  Thanks again!

Copyright (c) Marimer LLC