Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get methods is not map model Guid?(nullable guid) property #300

Open
EyupEnsar opened this issue Jun 15, 2022 · 2 comments
Open

Get methods is not map model Guid?(nullable guid) property #300

EyupEnsar opened this issue Jun 15, 2022 · 2 comments
Assignees
Labels
Waiting for Information Waiting for additional information to replicate

Comments

@EyupEnsar
Copy link

Hello,

I have a uniqueidentifier type field that can be left blank in the table, I don't have any problems while recording, but when I want to retrieve the data, this field is empty for all data.

I realized that this is because the type of the field in the code is Guid?(nullable guid).

I request your support in this matter.

image
image
image

note: When the field is Guid(not nullable), data comes in, but because my field is defined as ForeignKey in the database, it gives an error while saving the data.

@valfrid-ly
Copy link
Collaborator

Hello, just to clarify, the information is coming from the same table or from the related one?

Could you please send the mapping information and how you are retrieving data?

@valfrid-ly valfrid-ly self-assigned this Jul 11, 2022
@valfrid-ly valfrid-ly added the Waiting for Information Waiting for additional information to replicate label Jul 11, 2022
@votrelec
Copy link

votrelec commented Jan 18, 2023

Hi, i have same problem. MS SQL, null FK uniqueidentifier. Property name in class and collumn name in DB are same, I am using automap only. In runtime, when property is type of Guid?, values read from table are always null. When i changed in Entity class property to type Guid, values are mapped (dbnull values are mapped to Guid.Empty) I cannot use Guid, as inserting Guid.Empty violates FK constraint. FK is nullable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for Information Waiting for additional information to replicate
Projects
None yet
Development

No branches or pull requests

3 participants