DbSets with Subtypes: The child/dependent side could not be determined for the one-to-one relationshipThe child/dependent side could not be determined for the one-to-one relationshipconfiguration of entity framework in dependent assemblyEntityFramework core model relationship issue while doing Add-MigrationEntity Framework 1-1 relationship: “The navigation property was not found on the dependent type ”ef core ignore navigation propertyUsing Transactions and TransactionScopes with Entity Framework Core 2.1 and dbcontextCodeFirst configuration error creation reason?Upgrading from Npgsql.EntityFrameworkCore.PostgreSQL 2.0.0 to 2.1.2 Foreign Key IssueDifferent User Types in ASP.NET Core 2.1 Using Compositiongetting error while trying to get “Grade” for StudentId=1How to add One to One relationship with Model first approach
Was the Psych theme song written for the show?
Patio gate not at right angle to the house
Is it possible for a particle to decay via gravity?
Efficiently finding furthest two nodes in a graph
Should students have access to past exams or an exam bank?
Boots or trail runners with reference to blisters?
Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?
Is Ear Protection Necessary For General Aviation Airplanes?
What clothes would flying-people wear?
Is it possible to tell if a child will turn into a Hag?
Embedded C - Most elegant way to insert a delay
Can living where Earth magnet ore is abundent provide any protection?
Would it take any sort of amendment to make DC a state?
Unknown indication below upper stave
Why didn't Stark and Nebula use jump points with their ship to go back to Earth?
What are these bugs on my milkweed?
Word for giving preference to the oldest child
"DDoouubbllee ssppeeaakk!!"
How can Paypal know my card is being used in another account?
Using Python in a Bash Script
Why did Windows 95 crash the whole system but newer Windows only crashed programs?
Bouncing map back into its bounds, after user dragged it out
Why are we moving in circles with a tandem kayak?
How would a lunar colony attack Earth?
DbSets with Subtypes: The child/dependent side could not be determined for the one-to-one relationship
The child/dependent side could not be determined for the one-to-one relationshipconfiguration of entity framework in dependent assemblyEntityFramework core model relationship issue while doing Add-MigrationEntity Framework 1-1 relationship: “The navigation property was not found on the dependent type ”ef core ignore navigation propertyUsing Transactions and TransactionScopes with Entity Framework Core 2.1 and dbcontextCodeFirst configuration error creation reason?Upgrading from Npgsql.EntityFrameworkCore.PostgreSQL 2.0.0 to 2.1.2 Foreign Key IssueDifferent User Types in ASP.NET Core 2.1 Using Compositiongetting error while trying to get “Grade” for StudentId=1How to add One to One relationship with Model first approach
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Similar to this question, I'm trying to get my EF object model squared away, and UNLIKE the linked question, I am in fact setting up the modelBuilder calls inside the actual DbContext, not a Snapshot. It looks something like:
modelBuilder.Entity<MyUser>()
.HasOne(a => a.MyProfile)
.WithOne(a => a.MyUser)
.HasForeignKey<MyProfile>(c => c.Id)
.HasPrincipalKey<MyUser>(x => x.UserIntId);
One difference here is that both MyUser
and MyProfile
inherit from other types, UserEntity
and ProfileEntity
, which in turn have associated properties, i.e. UserEntity
has UserEntity.Profile
of type ProfileEntity
and ProfileEntity
has ProfileEntity.User
of type UserEntity
.
So, the exception I get is:
System.InvalidOperationException: The child/dependent side could not be determined for the one-to-one relationship between 'UserEntity.Profile' and 'ProfileEntity.User'. To identify the child/dependent side of the relationship, configure the foreign key property. If these navigations should not be part of the same relationship configure them without specifying the inverse. See http://go.microsoft.com/fwlink/?LinkId=724062 for more details.
I'm not sure how to resolve this exception in this case without totally removing the inheritance (which I would like to avoid in order to save time having to do a refactor of base libraries).
c# asp.net-core entity-framework-core
add a comment |
Similar to this question, I'm trying to get my EF object model squared away, and UNLIKE the linked question, I am in fact setting up the modelBuilder calls inside the actual DbContext, not a Snapshot. It looks something like:
modelBuilder.Entity<MyUser>()
.HasOne(a => a.MyProfile)
.WithOne(a => a.MyUser)
.HasForeignKey<MyProfile>(c => c.Id)
.HasPrincipalKey<MyUser>(x => x.UserIntId);
One difference here is that both MyUser
and MyProfile
inherit from other types, UserEntity
and ProfileEntity
, which in turn have associated properties, i.e. UserEntity
has UserEntity.Profile
of type ProfileEntity
and ProfileEntity
has ProfileEntity.User
of type UserEntity
.
So, the exception I get is:
System.InvalidOperationException: The child/dependent side could not be determined for the one-to-one relationship between 'UserEntity.Profile' and 'ProfileEntity.User'. To identify the child/dependent side of the relationship, configure the foreign key property. If these navigations should not be part of the same relationship configure them without specifying the inverse. See http://go.microsoft.com/fwlink/?LinkId=724062 for more details.
I'm not sure how to resolve this exception in this case without totally removing the inheritance (which I would like to avoid in order to save time having to do a refactor of base libraries).
c# asp.net-core entity-framework-core
Share us the full code forMyUser
,MyProfile
,UserEntity
andProfileEntity
– Tao Zhou
Mar 27 at 2:26
The issue I ran into here is that there were some inheritance issues and some other objects in the DI container also configuring the same relations. I cleaned those up and this resolved.
– Finster
Apr 25 at 15:41
You could append your solution as answer.
– Tao Zhou
Apr 26 at 1:41
add a comment |
Similar to this question, I'm trying to get my EF object model squared away, and UNLIKE the linked question, I am in fact setting up the modelBuilder calls inside the actual DbContext, not a Snapshot. It looks something like:
modelBuilder.Entity<MyUser>()
.HasOne(a => a.MyProfile)
.WithOne(a => a.MyUser)
.HasForeignKey<MyProfile>(c => c.Id)
.HasPrincipalKey<MyUser>(x => x.UserIntId);
One difference here is that both MyUser
and MyProfile
inherit from other types, UserEntity
and ProfileEntity
, which in turn have associated properties, i.e. UserEntity
has UserEntity.Profile
of type ProfileEntity
and ProfileEntity
has ProfileEntity.User
of type UserEntity
.
So, the exception I get is:
System.InvalidOperationException: The child/dependent side could not be determined for the one-to-one relationship between 'UserEntity.Profile' and 'ProfileEntity.User'. To identify the child/dependent side of the relationship, configure the foreign key property. If these navigations should not be part of the same relationship configure them without specifying the inverse. See http://go.microsoft.com/fwlink/?LinkId=724062 for more details.
I'm not sure how to resolve this exception in this case without totally removing the inheritance (which I would like to avoid in order to save time having to do a refactor of base libraries).
c# asp.net-core entity-framework-core
Similar to this question, I'm trying to get my EF object model squared away, and UNLIKE the linked question, I am in fact setting up the modelBuilder calls inside the actual DbContext, not a Snapshot. It looks something like:
modelBuilder.Entity<MyUser>()
.HasOne(a => a.MyProfile)
.WithOne(a => a.MyUser)
.HasForeignKey<MyProfile>(c => c.Id)
.HasPrincipalKey<MyUser>(x => x.UserIntId);
One difference here is that both MyUser
and MyProfile
inherit from other types, UserEntity
and ProfileEntity
, which in turn have associated properties, i.e. UserEntity
has UserEntity.Profile
of type ProfileEntity
and ProfileEntity
has ProfileEntity.User
of type UserEntity
.
So, the exception I get is:
System.InvalidOperationException: The child/dependent side could not be determined for the one-to-one relationship between 'UserEntity.Profile' and 'ProfileEntity.User'. To identify the child/dependent side of the relationship, configure the foreign key property. If these navigations should not be part of the same relationship configure them without specifying the inverse. See http://go.microsoft.com/fwlink/?LinkId=724062 for more details.
I'm not sure how to resolve this exception in this case without totally removing the inheritance (which I would like to avoid in order to save time having to do a refactor of base libraries).
c# asp.net-core entity-framework-core
c# asp.net-core entity-framework-core
edited Mar 26 at 21:19
Ashkan Mobayen Khiabani
24k19 gold badges71 silver badges128 bronze badges
24k19 gold badges71 silver badges128 bronze badges
asked Mar 26 at 21:17
FinsterFinster
3611 gold badge6 silver badges23 bronze badges
3611 gold badge6 silver badges23 bronze badges
Share us the full code forMyUser
,MyProfile
,UserEntity
andProfileEntity
– Tao Zhou
Mar 27 at 2:26
The issue I ran into here is that there were some inheritance issues and some other objects in the DI container also configuring the same relations. I cleaned those up and this resolved.
– Finster
Apr 25 at 15:41
You could append your solution as answer.
– Tao Zhou
Apr 26 at 1:41
add a comment |
Share us the full code forMyUser
,MyProfile
,UserEntity
andProfileEntity
– Tao Zhou
Mar 27 at 2:26
The issue I ran into here is that there were some inheritance issues and some other objects in the DI container also configuring the same relations. I cleaned those up and this resolved.
– Finster
Apr 25 at 15:41
You could append your solution as answer.
– Tao Zhou
Apr 26 at 1:41
Share us the full code for
MyUser
,MyProfile
,UserEntity
and ProfileEntity
– Tao Zhou
Mar 27 at 2:26
Share us the full code for
MyUser
,MyProfile
,UserEntity
and ProfileEntity
– Tao Zhou
Mar 27 at 2:26
The issue I ran into here is that there were some inheritance issues and some other objects in the DI container also configuring the same relations. I cleaned those up and this resolved.
– Finster
Apr 25 at 15:41
The issue I ran into here is that there were some inheritance issues and some other objects in the DI container also configuring the same relations. I cleaned those up and this resolved.
– Finster
Apr 25 at 15:41
You could append your solution as answer.
– Tao Zhou
Apr 26 at 1:41
You could append your solution as answer.
– Tao Zhou
Apr 26 at 1:41
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366324%2fdbsets-with-subtypes-the-child-dependent-side-could-not-be-determined-for-the-o%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366324%2fdbsets-with-subtypes-the-child-dependent-side-could-not-be-determined-for-the-o%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Share us the full code for
MyUser
,MyProfile
,UserEntity
andProfileEntity
– Tao Zhou
Mar 27 at 2:26
The issue I ran into here is that there were some inheritance issues and some other objects in the DI container also configuring the same relations. I cleaned those up and this resolved.
– Finster
Apr 25 at 15:41
You could append your solution as answer.
– Tao Zhou
Apr 26 at 1:41