Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 183229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:04:43+00:00 2026-05-11T15:04:43+00:00

Getting data from a database table to an object in code has always seemed

  • 0

Getting data from a database table to an object in code has always seemed like mundane code. There are two ways I have found to do it:

  1. have a code generator that reads a database table and creates the class and controller to map the datafields to the class fields or
  2. use reflection to take the database field and find it on the class.

The problems noted with the above 2 methods are as noted below

  • Method 1 seems to me like I’m missing something because I have to create a controller for every table.
  • Method 2 seems to be too labor intensive once you get into heavy data access code.

Is there a third route that I should try to get data from a database onto my objects?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:04:44+00:00Added an answer on May 11, 2026 at 3:04 pm

    I think the answer to this depends on the available technologies for the language you are going to use.

    I for one am very successful with the use of an ORM (NHibernate) so naturally I may recommend option one.

    There are other options that you may wish to take though:

    • If you are using .NET, you may opt to use attributes for your class properties to serve either as a mapping within a class, or as data that can be reflected
    • If you are using .NET, Fluent NHibernate will make it quite easy to make type-safe mappings within your code.
    • You can use generics so that you will not need to make a controller for every table, although I admit that it will be likely that you will do the latter anyway. However the generics can contain most of the general CRUD methods that is common to all tables, and you will only need to code specific quirks.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 201k
  • Answers 201k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer %option nodefault is equivalent to -s May 12, 2026 at 8:04 pm
  • Editorial Team
    Editorial Team added an answer I can't say for sure because the VB syntax has… May 12, 2026 at 8:04 pm
  • Editorial Team
    Editorial Team added an answer The problem isn't in the list construction, it's in this… May 12, 2026 at 8:04 pm

Related Questions

Is there a pre-built ModelBinder I can use with LINQ to get an object
I am using NHibernate/Fluent NHibernate in an ASP.NET MVC app with a MySQL database.
An external DB admin guy exported a production database and imported it into test
I have a Silverlight application that communications with an ASP.NET backend through WCF. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.