Nullable foreign key causes runtime error in OData service
-
I have used OData in my asp.net core project. I have problem with nullable foreign keys. When I want to use expand in url query, there is an exception that says:
System.InvalidOperationException: Nullable object must have a value.
I have provided a simple reproducible project in GitHub GitHub - codeblock88/temp: This repository is used for debugging.[^]repository. Please help me to solve this problem.
-
I have used OData in my asp.net core project. I have problem with nullable foreign keys. When I want to use expand in url query, there is an exception that says:
System.InvalidOperationException: Nullable object must have a value.
I have provided a simple reproducible project in GitHub GitHub - codeblock88/temp: This repository is used for debugging.[^]repository. Please help me to solve this problem.
-
I want to expand it for records are not null.
-
I want to expand it for records are not null.
It's not "records" that can be null, but individual fields in the record. You're not making much sense, so you're going to have to do a much better job of explaining what you're trying to do. As for the error you're getting, show the code that's throwing it.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
I have used OData in my asp.net core project. I have problem with nullable foreign keys. When I want to use expand in url query, there is an exception that says:
System.InvalidOperationException: Nullable object must have a value.
I have provided a simple reproducible project in GitHub GitHub - codeblock88/temp: This repository is used for debugging.[^]repository. Please help me to solve this problem.
There's nothing in that project that would actually call your API and produce that error. Where's the actual reproduction of the error?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I want to expand it for records are not null.
-
I have used OData in my asp.net core project. I have problem with nullable foreign keys. When I want to use expand in url query, there is an exception that says:
System.InvalidOperationException: Nullable object must have a value.
I have provided a simple reproducible project in GitHub GitHub - codeblock88/temp: This repository is used for debugging.[^]repository. Please help me to solve this problem.
"Nullable foreign keys". Sounds like the definition of an orphan. (You need a "null' parent in those cases; if you want to stay sane)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
I have used OData in my asp.net core project. I have problem with nullable foreign keys. When I want to use expand in url query, there is an exception that says:
System.InvalidOperationException: Nullable object must have a value.
I have provided a simple reproducible project in GitHub GitHub - codeblock88/temp: This repository is used for debugging.[^]repository. Please help me to solve this problem.
Replace the null with a zero and filter them out in your query.
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP