Questions tagged [circular-reference]

A circular reference is a series of references where the last object references the first, resulting in a closed loop.

A circular reference is a series of references where the last object references the first, resulting in a closed loop.

Circular references can appear in computer programming when one piece of code requires the result from another, but that code needs the result from the first.

Information is taken from Wikipedia, more information available there.

758 questions
5
votes
5 answers

Circular reference in C++ without pointers

Is there a way to define circular references without using pointers? I need to have somthing like this: struct A; struct B { A a; }; struct A { B b; }; Thanks!
Michel
  • 163
  • 1
  • 2
  • 7
5
votes
1 answer

Encountering self recursive assembly references in the .NET framework

I was writing some C# code recursively walking the referenced assemblies of a base assembly, building up a directed acyclic graph of these references to do a topological sort. I'm doing this by means of the GetReferencedAssemblies() method on the…
5
votes
2 answers

Circular references between two classes

I know this must be a n00b question, but I have to implement a mockup client-server sequential interaction application, and because the number of client-server calls varies, I cannot just iterate the steps in an external function, always fetching…
5
votes
1 answer

How do I declare circular dependant abstract Classes in F#

Consider the two abstract classes alpha and beta: [] type alpha () = abstract member foo: beta->beta [] and beta () = //*** abstract member bar: alpha If I try to compile that I get an error, on the line…
5
votes
2 answers

Circular References in RavenDB

I'm using RavenDB with models like: public class Cart { List Items = new List(); } public class Item { public Cart Cart; } When I add an Item to a Cart, I wire up both sides of the relationship. How does RavenDB handle…
bendytree
  • 13,095
  • 11
  • 75
  • 91
4
votes
1 answer

Circular References and ScriptIgnore problems

I have several BusinessObject classes that refer to each other and I need to serialize one in a JsonResponse and return it to my view. I keep getting a circular reference exception and I cannot get rid of it. I have placed the [ScriptIgnore()]…
CodeWarrior
  • 7,388
  • 7
  • 51
  • 78
4
votes
2 answers

Circular Match

I have a database with three tables: userid_tbl, need_tbl, have_tbl create table userid_tbl (user_id varchar2(15) not null primary key); create table need_tbl (user_id varchar2(15) not null, have_item varchar2(100) not null, foreign key (user_id)…
Wally
4
votes
2 answers

C++ garbage collection and circularly referenced data

I'm currently implementing my garbage collector (in C++) using reference counting technique. However, there's a major problem is that if the data is circularly referenced, they're never collected since their reference counts are always non-zero. I…
IcySnow
  • 851
  • 2
  • 14
  • 23
4
votes
1 answer

How to serialize a EF POCO auto-generated object to avoid circular references?

I'm using a library (Telerik) for ASP.NET MVC 3. I've a problem with all functionnalities which needs to return by AJAX some data: I'm using EF4 to connect my database, and I've(and need) navigation properties in both ways(Imagine, a User which have…
J4N
  • 19,480
  • 39
  • 187
  • 340
4
votes
6 answers

Why can't structs contain nullable circular references?

I understand why structs can't contain circular references which lead to logical memory problems, but why doesn't a nullable reference circumvent this limitation? For example: struct Foo { Foo? bar; } Obviously this could very easily lead to…
dlras2
  • 8,416
  • 7
  • 51
  • 90
4
votes
4 answers

Telerik MVC Grid with Ajax Binding using EntityObjects gets Circular References exception

I have been using Telerik MVC Grid for quite a while now. It is a great control, however, one annoying thing keeps showing up related to using the grid with Ajax Binding to objects created and returned from the Entity Framework. Entity objects have…
Kevin Koenig
  • 63
  • 1
  • 6
4
votes
1 answer

Best solution for EF 4.1 + MVC + JSON circular reference exception?

I'm using EF 4.1 Database First approach, with T4 template generating my POCO classes in separate assembly. I have repositories for fetching data, and service layer which is used for communication with UI. I was trying to make cascading…
4
votes
4 answers

Check for proper list in Common Lisp

Is there a standard function in Common Lisp that can check against improper lists (i.e. circular and dotted lists) without signaling an error? list-length can check against circular lists (it returns nil for them), but signals type-error when given…
Lassi
  • 3,522
  • 3
  • 22
  • 34
4
votes
1 answer

What's the best design for this problem with IoC and Circular Reference

I'll try to explain in the simple way. I have a solution (c# 4.0) that contain 4 projects Framework DAL Domain WebApplication So my question is: Framework is the right place to configure my Unity IoC? I want to configure via code and not with xml,…
4
votes
4 answers

Prevent circular reference in MS-SQL table

I have a Account table with ID and ParentAccountID. Here is the scripts to reproduce the steps. If the ParentAccountID is NULL then that is considered as Top level account. Every account should finally ends with top level account i.e…
Magendran V
  • 1,411
  • 3
  • 19
  • 33