I like design-time features of typed DataSet but I want to generate DTO and DAO-like classes instead of Tables and TableAdapters. The plan is to create something like MSDataSetGenerator. But for now it is implemented using T4:


Generated code is compatible with .NET Framework and .NET Compact Framework.

Successfully tested with:

  • System.Data.SqlClient
  • System.Data.SqlServerCe.3.5
  • System.Data.OracleClient
  • Oracle.DataAccess.Client (ODP.NET)
  • MySql.Data.MySqlClient
  • System.Data.SQLite
  • Devart.Data.PostgreSql (the only problem here is buggy DDEX)
  • System.Data.OleDb
  • etc.

The following T4 example generates DTO class and strongly-typed DAO-like wrapper to execute SQL command:

<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ include file="SQLite.Meddict.ttinclude" #>
namespace SQLite.Meddict.Term
    SqlDalMaker gen = new SqlDalMaker();
    gen.OpenConnection(dbProviderName, connectionUrl);
        RenderDtoClass(gen, "Term", xsd, "terms.GetTermsByGroupId");
        RenderQueryDtoList(gen, "Term", "CaGetTermsByGroupId", xsd, "terms.GetTermsByGroupId");

Project documentation is included to main download.

Implementation is ported from: http://utils4dal.sourceforge.net/sqldalmaker.html

Last edited Feb 25 at 2:07 PM by ss20, version 118