circular-reference

Circular Reference error when serializing objects in ASP.NET Web API

蹲街弑〆低调 提交于 2019-12-01 17:02:16
问题 I'm writing a Web API project in C# that uses Entity Framework to pull data from a DB, serialize it and send it to a client. My project has 2 classes, Post and Comment (foreign key from Post). These are my classes. Post class: public partial class Post { public Post() { this.Attachment = new HashSet<Attachment>(); this.Comment = new HashSet<Comment>(); } public int PostId { get; set; } public string Title { get; set; } public string Content { get; set; } public System.DateTime Created { get;

Circular reference among two .net assemblies

心已入冬 提交于 2019-12-01 15:45:46
问题 I have two assemblies A & B. A has existing reference to B and it must be kept that way. Right now I made some changes to B that need to refer to A. So circular reference occurs. Bit of details: A has a few property grids that the dialog in B needs to be hosted. So to avoid this circular reference issue I tried to define interfaces to grids in third assembly to which A & B both refer, and make B only refers to the interfaces. Two issues I'm facing: there’s too much custom data types

JavaScript/GSON: Access JSON references dynamically over object graph (circular references)

瘦欲@ 提交于 2019-12-01 14:28:58
I had the problem, to serialize my Java objects through Google GSON, because of several circular references. All my tries ended up in a StackOverflowException, because GSON is not able to handle those circular references. As a solution, I found following GraphAdapterBuilder : http://code.google.com/p/google-gson/source/browse/trunk/extras/src/main/java/com/google/gson/graph/GraphAdapterBuilder.java?r=1170 Example: https://groups.google.com/forum/#!topic/google-gson/z2Ax5T1kb2M { "0x1": { "name": "Google", "employees": [ "0x2", "0x3" ] }, "0x2": { "name": "Jesse", "company": "0x1" }, "0x3": {

JavaScript/GSON: Access JSON references dynamically over object graph (circular references)

[亡魂溺海] 提交于 2019-12-01 14:04:30
问题 I had the problem, to serialize my Java objects through Google GSON, because of several circular references. All my tries ended up in a StackOverflowException, because GSON is not able to handle those circular references. As a solution, I found following GraphAdapterBuilder : http://code.google.com/p/google-gson/source/browse/trunk/extras/src/main/java/com/google/gson/graph/GraphAdapterBuilder.java?r=1170 Example: https://groups.google.com/forum/#!topic/google-gson/z2Ax5T1kb2M { "0x1": {

Why do circular references and recursion make my program fail?

房东的猫 提交于 2019-12-01 09:26:28
I wrote this simple Prolog program. man(socrates). mortal(X) :- man(X). immortal(X) :- immortal(X). I asked it the usual questions, such as whether Socrates is a man or if Socrates is a mortal. ?- man(socrates). true. //we know for a fact that Socrates is a man ?- mortal(socrates). true. //and it can logically be inferred that Socrates is mortal ?- immortal(socrates). //but we can't seem to figure out if he's immortal It crashed because of the recursive definition of immortal . Circular references also make it crash or error with Out of stack space. It seems to me that, at least in this case,

Dynamically creating graphql schema with circular references

假如想象 提交于 2019-12-01 09:03:47
By using graphql-js, I need to create graphql schema dynamically by iterating over array of some data, for example: [{ name: 'author', fields: [{ field: 'name' }, { field: 'books', reference: 'book' }] }, { name: 'book', fields: [{ field: 'title' }, { field: 'author', reference: 'author' }] }] The problem is circular references. When I'm creating AuthorType I need BookType to be already created and vise versa. So resulting schema should look like: type Author : Object { id: ID! name: String, books: [Book] } type Book : Object { id: ID! title: String author: Author } How can I solve this?

How to manage circular references in delphi units?

孤人 提交于 2019-12-01 08:33:13
I am using the BeforSignup in the AfterSignup unit in order to be able to call the email variable from within AfterSignup code, finally i enbcountred a problem because i want to make a button which opens the AfterSignup window using the code : AfterSignup.Show; But the problem is that i am obliged to add the AfterSignup unit to the uses list of BeforeSignup and that is exactly what i can't do because i am alreadey using BeforeSignup to AfterSignup unit. i receive an error saying, a reference of circular unit. The easy solution would be to add unitA in the uses clause of the interface section

Dynamically creating graphql schema with circular references

萝らか妹 提交于 2019-12-01 06:39:14
问题 By using graphql-js, I need to create graphql schema dynamically by iterating over array of some data, for example: [{ name: 'author', fields: [{ field: 'name' }, { field: 'books', reference: 'book' }] }, { name: 'book', fields: [{ field: 'title' }, { field: 'author', reference: 'author' }] }] The problem is circular references. When I'm creating AuthorType I need BookType to be already created and vise versa. So resulting schema should look like: type Author : Object { id: ID! name: String,

How to manage circular references in delphi units?

情到浓时终转凉″ 提交于 2019-12-01 06:04:45
问题 I am using the BeforSignup in the AfterSignup unit in order to be able to call the email variable from within AfterSignup code, finally i enbcountred a problem because i want to make a button which opens the AfterSignup window using the code : AfterSignup.Show; But the problem is that i am obliged to add the AfterSignup unit to the uses list of BeforeSignup and that is exactly what i can't do because i am alreadey using BeforeSignup to AfterSignup unit. i receive an error saying, a reference

Why do circular references and recursion make my program fail?

别来无恙 提交于 2019-12-01 05:35:49
问题 I wrote this simple Prolog program. man(socrates). mortal(X) :- man(X). immortal(X) :- immortal(X). I asked it the usual questions, such as whether Socrates is a man or if Socrates is a mortal. ?- man(socrates). true. //we know for a fact that Socrates is a man ?- mortal(socrates). true. //and it can logically be inferred that Socrates is mortal ?- immortal(socrates). //but we can't seem to figure out if he's immortal It crashed because of the recursive definition of immortal . Circular