C
C#15mo ago
scorch

❔ SQL Table to Object

I have a SQL Table "Card" with a column "CardNr" and a column "CardType". How would I make this in to an object of my Card class?
4 Replies
Angius
Angius15mo ago
Depends what you want to use ADO? You'll need to wrestle with the reader, convert the values, all sorts of songs and dances Dapper? Just execute the query and pass the class as a generic parameter EF Core? Hopefully you're using code-first design, but if not... well I never used database-first design, but I guess you could just scaffold the code and use regular EF queries
Anton
Anton15mo ago
If you're using Visual Studio, there's an EF Core extension for database-first EF Core power tools I've seen it recommended a lot
rhymbit
rhymbit15mo ago
There's also a class called DataTable in C#. You can check it out as well https://learn.microsoft.com/en-us/dotnet/api/system.data.datatable?view=net-8.0
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ How to pull nuget packages from private Github registry when doing dotnet restore in Github actionDoes anyone know how to run `dotnet restore` from a Github action on a project that uses nuget packa❔ how can i re use the readline after using it in a if statementso basically im using readline and if it == "hello" for example, it'd writeline "hi!", then the prog❔ Moq test exception thrown after adding and saved changes to the context object```Exception has occurred: CLR/Moq.MockException Exception thrown: 'Moq.MockException' in Moq.dll: '❔ Make package C private in project A, which inherits project B which uses package CI have 2 projects, project A and B. project A inherits project B (dependency). however, I want proj❔ Possible to have whole app margin/padding in NET MAUI?Would it be possible to have an internal margin/padding for the whole presentation of the app?❔ error 8007006EHello, when I want to publish my WPF application with ClickOnce, I have an error: 8007006E and I don✅ No IntelliSense in VSCodeHey, my VSCode is lacking of IntelliSense when I code in C#. I tried everything, I'm full of despair❔ Splittings UT8 textI have an UTF8 text file text that is delimited by `╚` for lines and then further by `&` for values.❔ Weird SocketAsyncEventArgs server behaviourwhat might be the reason for this? All i'm doing is accepting a connection with SocketAsyncEventArgs❔ Stack Overflow error while trying to deserialize xml fileHeres the error: ``` Stack overflow. Repeat 104785 times: -------------------------------- at XM