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
I'm working on writing a Blazor app using .NET 8. I've got a database with column names that have embedded whitespace. When I deserialize it all the numeric values (SMALLINT in a SQL Server database) are 0 (for example the column "Video Number"), which is wrong and doesn't correctly show what's in the table. However, when I check the values using Swagger, it is perfectly correct. I had thought that the attribute JsonPropertyName would resolve my issue, but it doesn't. Here's my class
publicpartialclassEntry{[Key,Column("Video Number", Order =0)][JsonPropertyName("Video Number")]publicshortVideoNumber{get;set;}[Key,Column("Entry", Order =1)]publicbyteEntry1{get;set;}[Required]publicshortShowCode{get;set;}[Required]publicstringEpisodeName{get;set;}=null!;publicDateTime?ActualPlayTime{get;set;}publicboolCompleted{get;set;}publicstring?Comment{get;set;}publicTimeOnly?ActualPlayTime1{get;set;}publicvirtualShowShow{get;set;}=null!;publicvirtualVideoVideoNumberNavigation{get;set;}=null!;}
And here's the code snippet where I'm trying to read the data out of the table:
Type of issue
Other (describe below)
Description
I'm working on writing a Blazor app using .NET 8. I've got a database with column names that have embedded whitespace. When I deserialize it all the numeric values (SMALLINT in a SQL Server database) are 0 (for example the column "Video Number"), which is wrong and doesn't correctly show what's in the table. However, when I check the values using Swagger, it is perfectly correct. I had thought that the attribute JsonPropertyName would resolve my issue, but it doesn't. Here's my class
And here's the code snippet where I'm trying to read the data out of the table:
Page URL
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/customize-properties
Content source URL
https://github.com/dotnet/docs/blob/main/docs/standard/serialization/system-text-json/customize-properties.md
Document Version Independent Id
27c18218-d28f-a524-b7e1-8262005b7026
Article author
@gewarren
Metadata
Related Issues
The text was updated successfully, but these errors were encountered: