Re: Circular References

Discussion in 'ASP .Net' started by Bill Jones, Apr 8, 2004.

  1. Bill Jones

    Bill Jones Guest

    I ran into the same exact problem. Here is how I got around.

    I'm writing a scheduling application to schedule classes. So I have one
    project that is my sched_da (data access) project, one project that is my
    sched_data (data) project, and another sched_bl (business logic) that is
    where my objects live.

    The sched_bl project references the sched_data and the sched_da project.
    The sched_da project references only the sched_data project.
    The sched_data project references neither of the other two.

    So for one object, let's say a course class:

    in the sched_bl project I have

    public class course{
    private courseData cd = new courseData();

    public string courseName{
    get{
    return cd.course_name;
    }
    set{
    cd.course_name = value;
    }
    }

    public void save(){
    coursePersist.save(cd);
    }
    }

    in the sched_data project I have

    public class courseData{
    public int id;
    public string course_name;
    public string course_code;
    ...etc
    }

    in the sched_da project I have

    public class coursePersist{
    public static void save(courseData cd){
    //in here do all the things to save my courseData values to my
    database
    }
    }

    I left out many of the methods and other details. Is this enough for you to
    get the point? It might help if you draw it out on a white board or
    something. Sorry my examples are in C#, I don't know VB very well.

    - Bill Jones.



    "Dave" <> wrote in message
    news:...
    > I have a DataStructure project that implements a series of strongly-typed

    collection classes
    > I have a DataAccess Project that does all my data access
    >
    > From a class in the DataStructure project I want to call a method in the

    DataAccess with the DataStructure class passing "itself" (ME) to the
    DataAccess method. In other words, from the DataStructure class do
    >
    > dim MyDataAccessObject as new DataAccess.Class
    > MyDataAccessObject.Insert(Me)
    >
    > This would require the DataAccess class to accept an argument of the

    DataStructure type. For example, in the DataAccess class
    >
    > Sub Insert(InsertedObject as DataStructureType)
    >
    > To do that I would need to have both projects reference eachother. But

    when try to create those references you get
    >
    > A reference to <class> could not be added. Adding this project as a

    reference would cause a circular dependancy.
    >
    > Any Ideas on how to get around this?
    Bill Jones, Apr 8, 2004
    #1
    1. Advertising

  2. Thanks Bill -

    Looks like what I needed...I'll have a run at it tommorrow morning...
    =?Utf-8?B?RGF2ZQ==?=, Apr 8, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan C Douglas

    Circular references are not supported

    Dan C Douglas, Aug 13, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,402
    Steve C. Orr, MCSD
    Aug 13, 2003
  2. =?Utf-8?B?S2VpdGggRi4=?=

    Circular References in Visual Studio

    =?Utf-8?B?S2VpdGggRi4=?=, Aug 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    6,244
    Cowboy \(Gregory A. Beamer\) [MVP]
    Aug 6, 2004
  3. BBuff
    Replies:
    0
    Views:
    2,449
    BBuff
    Sep 26, 2005
  4. Joey
    Replies:
    0
    Views:
    2,472
  5. Kiuhnm
    Replies:
    16
    Views:
    727
    Jonathan Mcdougall
    Jan 3, 2005
Loading...

Share This Page