question

AmolM-8921 avatar image
0 Votes"
AmolM-8921 asked JackJJun-MSFT commented

EF6 How to get navigation properties when Parent entity in detach state.

I am using detach for performance, I need solutions to load navigation property when parent entity is in detach state. I read many article looks like not possible just trying my luck if anyone has any idea.

I want to maintain all data after detach.

Thanks in advance

dotnet-entity-framework
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JackJJun-MSFT avatar image
0 Votes"
JackJJun-MSFT answered JackJJun-MSFT commented

@AmolM-8921 , Welcome to Microsoft Q&A, you could refer to the question restoring navigation property after detaching entities to restore the properties after detaching the entities.

Code:

 context.LoadProperty(customer, c => c.Orders, MergeOption.OverwriteChanges);



· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AmolM-8921, thanks for the feedback, I want to know if my solution solves your problem, If so,please click "Accept Answer" and upvote it. If you have extra questions about this answer, please click "Comment".

Thanks for your understanding.

0 Votes 0 ·