KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've got a class like this: public class Product { public int ProductId { get; private set; } public int SupplierId { get; private set; } public string Name { get; private set; } public decimal Price { get; private set; } public int Stock { get; private set; } public int PendingStock { get; private set; } } I can fetch those details from my database like this: SELECT product_id, supplier_id, name, price, total_stock, pending_stock FROM products WHERE product_id = ? I don't want to have to manually run through a DataSet or DataTable to set the values. I'm sure there's a way to populate the class using some kind of binding / mapping mechanism, but the only stuff I could find was for binding to winforms components or using XAML. Is there some kind of attribute I can apply to my properties / class to have the class automatically populated from a query row?
Tags (comma-separated)
Save Edits
Cancel