Archive

Archive for August, 2012

DataTable To C# Entity Class & SP Generator

August 30, 2012 2 comments

C# DAL Generator

A big problem when we want to return data fromdatabase as a entity class or entity collection. or want to generate sp for Insert/update. So please download code from link.

So here is class that can generate C# class from a datatable

click here to view/download source code in google drive

https://drive.google.com/folderview?id=0B4KZ3fpkDk5RYXUtSnctVl9seWc&usp=sharing

\\How to use

private void button4_Click(object sender, EventArgs e)
{
DataTableToEntityGenerator.EntityClassName = dt.TableName;
DataTableToEntityGenerator.SourceTable = dt;
textBox1.Text = DataTableToEntityGenerator.GetColumnNameWithDataType();
}

private void button5_Click(object sender, EventArgs e)
{
DataTableToEntityGenerator.EntityClassName = dt.TableName;
DataTableToEntityGenerator.SourceTable = dt;
textBox1.Text = DataTableToEntityGenerator.GenerateDMLSP2005();
}

private void button6_Click(object sender, EventArgs e)
{
DataTableToEntityGenerator.EntityClassName = dt.TableName;
DataTableToEntityGenerator.SourceTable = dt;
textBox1.Text = DataTableToEntityGenerator.GenerateDALWithQuery(“Factory” , ddlDB.Text);
}

Advertisements
Categories: C#