You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
I have a question about the generated code for a one-to-one relation.
In each entity's constructor, it's required to pass the linked entity.
For example, if I have an entity Student which is linked with a StudentAddress in a one-to-one relation, I have to write a code like this :
We do need to handle that better. What you can do in the interim is create a custom constructor in the partial that doesn't have the required property involved in the chicken-and-egg scenario. That's what we'll be doing to fix the problem permanently, only it'll be generated rather than custom.
Thanks for the response.
Effectively I use this kind of workaround. Unfortunately, I can't create a constructor with no param, because of the generated one, whom is protected. So I have created a public static method to create an instance of my first class, and set the property after that call.
Maybe the "chicken" class constructor should create the "egg" instance directly to simplify the process ?
msawczyn
added
released
Issue is resolved in a current release
and removed
pending release
Issue is resolved in the current codebase, will be published with the next release
workaround available
There's a problem that needs fixed, but a procedure can currently be used to get the same result
labels
Jul 12, 2019
Hi,
I have a question about the generated code for a one-to-one relation.
In each entity's constructor, it's required to pass the linked entity.
For example, if I have an entity Student which is linked with a StudentAddress in a one-to-one relation, I have to write a code like this :
This code doesn't work, so how should I proceed to make this working ?
Circular requirement of entities by constructor is maybe a bug ?
The text was updated successfully, but these errors were encountered: