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
0
votes
1 answer

JsonMediaTypeFormatter trying to deserialise a property with IgnoreDataMember attribute

I have a JSON string such as: { "$id": "1", "Username": "mrdan", "Email": "mrdan@hotmale.co.uk", "Roles": [ { "$id": "2", "Name": "Super Admin", "Users": [ { "$ref": "1" } ], …
Dan Rayson
  • 1,315
  • 1
  • 14
  • 37
0
votes
1 answer

How to correctly use Data Annotations to select which Items should be returned by the Web API?

I'm trying to specify a subset of data to be returned from a database query by Web API 2. In particular, for this query, I first turn lazy loading on: db.Configuration.LazyLoadingEnabled = true; This is because there are potentially infinite…
0
votes
1 answer

Handling Jackson circular dependencies using a context stack instead of using JsonIdentityInfo, or JsonBackReference & JsonManagedReference

I am using Jackson to serialize JSON, but my JSON clients are not Java, and don't use Jackson. I want to avoid circular reference serialization infinite recursion by, whenever serializing a whole bean would cause an infinite recursion, serializing…
XDR
  • 4,070
  • 3
  • 30
  • 54
0
votes
2 answers

Find element in deep hierarchy - iteration vs recursion

My menu hierarchy looks like this: Root ProductGroups Products ItemTypes Items I avoided circular references so there are only references from a parent to its childs, e.g. a ProductGroup references its…
10ff
  • 813
  • 4
  • 16
  • 31
0
votes
2 answers

How do I create "reverse links" amongst Python classes without circular imports?

Suppose I have a Python class called Person in file person.py as follows: class Person(object): static_id = 0 instance_id = None @staticmethod def new_id(): Person.static_id += 1 return Person.static_id def…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
0
votes
0 answers

Circular reference(?) when Either class has param containing other class

So I have notice during a print_r statement this creates a circular reference. Should I avoid having both classes having each other as a parameter? Aside from the print_r statement (which php seems to recognize as circular and not continue to…
Chris
  • 2,166
  • 1
  • 24
  • 37
0
votes
1 answer

How to prevent circular references in these Django models?

Suppose I have 2 Django applications in my project: appA, appB. appA contains ModelA as follows in its models.py: class ModelA(models.Model): field1 = models.CharField(max_length=254, null=False, blank=False,) appB contains ModelB as follows in…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
0
votes
2 answers

a design to avoid circular reference in this scenario

Here is our dependency tree: BigApp -> Child Apps -> Libraries ALL of our components are HEAVILY using one of the Libraries as above ( LibA). But it has a ‘few’ public methods that require classes from ‘higher-level’ assemblies and we want to avoid…
Bohn
  • 26,091
  • 61
  • 167
  • 254
0
votes
1 answer

A circular reference was detected while serializing an object of type \u0027ASP.global_asax

I apologize if this has been asked already. I'm fairly new to asp.net stuff, and I did search around, but I couldn't find solution I am able to apply to my situation - or able to apply in a way I know how. Anyway, here's the issue. I am building a…
adprocas
  • 1,863
  • 1
  • 14
  • 31
0
votes
0 answers

Circular references on every page when opening project on another computer

In order to work on my website on a second computer, I put the project on an usb key and opened it. The initial project is building correctly, but whenever I try to open it on the second machine, I have a circular reference issue on every single…
Flash_Back
  • 565
  • 3
  • 8
  • 31
0
votes
2 answers

C2061 - Circular dependency

How to avoid circular dependency on these code: Mechanic.cpp: #include "stdafx.h" #include "Characters.h" #include "Monsters.h" using namespace characters; using namespace monsters; using namespace std; void character::character_atack(character…
Kulis
  • 988
  • 3
  • 11
  • 25
0
votes
1 answer

When I implement polynomials using linked lists and circular representation the circular link breaks off. Can any one tell me why?

I am trying to implement polynomials using linked lists and circular representation i.e. link of the last node pointing to the first node(header). When I create my first polynomial using the function create all the links get established perfectly,…
0
votes
1 answer

How to do an INSERT into tables with circular relationships (SQL SERVER)

I'm dealing with a set of tables in a database that appear to have a circular relationship (see image). This is the ARTS database if that is of any help to anyone. A user signing on: a) must create a (insert into) session, which in turn needs a…
John
  • 3,591
  • 8
  • 44
  • 72
0
votes
2 answers

How to avoid circular loop in Linq to Sql query?

Currently I am using [JsonIgnore] property to avoid circular references in the models. But I think, it will be applied in all implementations. Right now I am using like this- I have two Models: public class Project { public int ProjectID { get;…
Abhinav
  • 353
  • 1
  • 7
  • 19
0
votes
3 answers

Circular Relationship in Database Design with 3 tables

How would you accomplish these requirements? Faculty has many Members. Faculty belongs to a Council. Now - in the Council there is one representative member from corresponding Faculty. This part creates a circular relationship (see image). Where is…
David S
  • 723
  • 1
  • 6
  • 7