Project Description
Auto generate code to build objects (DTOs, Models, etc) from a data table.

Linq to SQL, Entity Framework and nHibernate are all great tools for mapping but they are not always the best solution. Most of the projects I deal with do not need an ORM so all of the data operations are done via stored procedures and datasets. Writing code to populate an object from a datarow is tedious and time consuming.

Table2DTO is a set of attributes and a T4 template that will generate extension methods for objects decorated with the Table2DTO attributes so you can skip right to the important code.

Adds extension methods to:
  • CustomObject.BuildFromDataRow() - Populates instance of CustomObject from a DataRow
  • ICollection<CustomObject>.BuildFromDataTable() - Populates collection of CustomObject from a DataTable

Current limitations:
  • Only works on properties
  • Only works on public properties (due to limitations on extension methods)

Future plans:
  • Support partial class support if decorated class is partial (instead of extension method)
  • Aspect for use with PostSharp for MSIL injection instead of codegen
  • Mapping IDE (Visual Studio add-on)

Last edited Jan 6, 2011 at 11:04 PM by DustinDavis, version 7