This project has moved. For the latest updates, please go here.
Project Description
Generate your CRUD Stored procedures. Write your own custom stored procedrues. Now, generate generate a complete data access layer that is Data Bindable.
  • Generate basic CRUD stored procedures.
  • Call any stored procedure from a .NET applications without manually writting ADO.NET.
  • Have the compiler check your code instead of putting everything in strings.
  • Incorporate your custom stored procedures.
  • Generate data objects for OO and Data Binding.

Click here for a seriese of articles on this project:

ZacksFiasco - Build a complete Stored Procedure based Data Access Layer using Code Generation Call any stored procedure.

Generate your stored procedures or write them yourself in TSQL:
-- <MetaData entityName="Table1" commandType="Insert"/>
CREATE PROCEDURE [api].[Table1Insert]
	@Table1Id uniqueidentifier,
	@Col1 varchar(50),
	@Col2 int = NULL,
	@rowversion timestamp = NULL OUTPUT

	INSERT INTO [dbo].[Table1]
	RETURN @@Error

Call it from C# like this:
using(DataAccess da = new DataAccess("MyConnectionStringName"))
    // call it like this
    byte[] rowversion = null;
    Guid? table1id = Guid.NewGuid();

    da.Table1Insert(table1id, "blah", 3, ref rowversion);

    // or like this
    Table1Obj t1 = new Table1Obj();

    t1.Table1Id = Guid.NewGuid();
    t1.Col1 = "blah2";
    t1.Col2 = 123;

    // select like this
    IDataReader reader = null;
    da.Table1SelectAll(ref reader);

        Console.WriteLine("ID={0}", (Guid)reader["Table1Id"]);

    // or like this
    List<Table1Obj> list = da.SelectObjTable1All();

    foreach(Table1Obj obj in list)
        Console.WriteLine("obj.Table1Id = {0}", obj.Table1Id);

This project uses MyGeneration scripts and other tools to create a complete DAL.

Last edited Feb 18, 2010 at 8:48 PM by ormico, version 19