Automatically mapping datatable to objects(improve.dk)

submitted by orcaorca(820) 4 years, 5 months ago

I often need to transfer data from my business layer to my presentation layers in a strongly typed way. In this example I'll use the following very struct and corresponding DataTable to represent the data I need to transfer.

2 comments |category: |Views: 90

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by brianjlowrybrianjlowry(640) 4 years, 5 months ago 0

Why not just build the objects with datareaders and pass them back instead of mapping them to a datatable. Seems like extra work to me.

Reply

posted by orcaorca(820) 4 years, 5 months ago 0

The DataTable is not the point of the article. The DataTable is simply used a simple means of creating my database structure - I couldn't do that using a DataReader. You could easily use a DataReader, but as mentioned, the point of this article is how to map an object to a datarow/datareader, not whether to use a DataTable or a DataReader.

Reply

information Login or create an account to comment on this story